New page of midlevel grouping in Active Reports v7 - grouping

This has me stumped but then again, I haven't done reports in like 10 years. We are using an old version, AR win 7.
I have groupings by state, Type A, County, Type B. Boss wants it to kick the new county to a new page so I set the NewPage to AfterPrint for the group footer (totals). Problem with that is, when it's the last county of the upper groups (State, Type A), those totals go on a new page but boss wants them on the same page of the last county.
I thought about changing the NewPage setting to BeforePrint on the County Group header, but then the state and type labels print on a page before the first county...want those on the same page too.
So what am I missing?

I guess I figured it out. Seems to work.
Removed the NewPage property setting on the report and set it in code....
Private Sub GroupHeader3_AfterPrint(sender As Object, e As EventArgs) Handles GroupHeader3.AfterPrint
GroupHeader3.NewPage = SectionReportModel.NewPage.Before
End Sub
Then set the GroupKeepTogether = FirstDetail on the two groupings above (State, Type A).
That seems to have done it.

Related

Oracle APEX - how to read a cell from interactive grid

The same question once again but with (I hope) better explanation:
I created the most simple case:
An Interactive Grid IG with data source EMP ( table with 14 records contains Ename, Job, HireDate, Salary etc. etc.)
Text field P7_ENAME
After running it looks like below:
What I would like to do is to copy Ename from selected record of IG to P7_ENAME field .
I found several tutorials (text and video) how to do it. Most of them suggest to create dynamic action SelectionChange on IG and when TRUE add a JavaScript code something like below:
var v_ename;
model = this.data.model;
v_ename = model.getValue( this.data.selectedRecords[0], "Ename");
apex.item( "P7_ENAME" ).setValue (v_ename);
and the second step is to create another action: Refresh.
So finally I have a dynamic action with two steps : the first one is a Java script code and the second refresh function on my P7_ENAME field.
Sounds simple and it is simple to repeat/implement. A guy (I suppose) from India published a video on YouTube (https://www.youtube.com/watch?v=XuFz885Yndw) which I followed and in his case it works good. In my case it simple does not work - field P7ENAME is always empty, no errors appears. Any idea why ? Any hints, suggestion ?
thanks for any help
K.
The best way to debug and achieve what you are trying to do is as follows:
create the Dynamic action with the following setup:
-when -> selection change[interactive grid],
-selection type -> region, region -> your IG region,
-client side condition -> javascript expression: ```this.data.selectedRecords[0] != undefined```
First action of the true of the DA with the type: execute javascript code and fire on initialization is turned on, code: console.log(this.data.selectedRecords);
Run your page, and check the browser console. You should see an array of columns when you select a record from that IG as follows:
Find in that array, which sort number of the array contains the data that you want to use for the page item. Let's say I want the 3rd element which is "2694" then I should change my dynamic action's execute javascript code to:
var value = this.data.selectedRecords[0][2];
apex.item( "P7_ENAME" ).setValue (value);
The last thing I should do is add another true action (and the refresh action at the end) to the same dynamic action with type 'SET VALUE' and 'PLSQL EXPRESSION' as type, put :P7_ENAME in the expression, items to submit P7_ENAME and affected element: item / P7_ENAME as follows:

Can I create a link based on multiple columns in Siebel?

Our Siebel application has 2 tables, both of them sharing 4 text fields. I want to create a link, to show as a child BC all the records from the second table, having the same 4 values as the current record from the first table.
In SQL this could be easily done with something like this:
select *
from table1 t1
left join table2 t2 on (t1.a = t2.a and t1.b = t2.b and t1.c = t2.c and t1.d = t2.d)
where t1.row_id = '1-23456';
Can I build something similar in Siebel 7.8?
I thought creating a link based on any of the text fields (the one with the least repeating values), and then filter the 3 remaining fields in the child BC search spec, but... how do I reference the parent BC values in a search spec? (Without using profile attributes or calculated fields, which would impact too much on performance).
Note: I can't change the tables for this task, however the child BC will be created for this task and won't be used elsewhere.
You will have to use a link search spec. Links can have searchspec, for exactly this reason. Go to links and search for NOT NULL on the searshspec column to see vanilla examples. The link searschspec is always applied on the child bc, so to accesss fields from parent bc, use the ParentFieldValue function
example:
[Account Id] = ParentFieldValue ("Account Id")
on link "Account Product - CPG/CG SVP Product Baseline - for Adding Data"

How to get shipping address in new column of order list in xcart

I am newbie in X Cart and working on XCart 5.2.5. I would like to know that how can I displays customer billing or shipping address in one new custom column of order list at back end.
Please see the attached screen shots below
Order list screenshot
Any kind of help will be appreciated.
You would need to decorate the \XLite\View\ItemsList\Model\Order\Admin\Search class and define a new column in the defineColumns() method.
The column definition should be something like this:
$columns['shipping_address'] = array(
static::COLUMN_NAME => 'Shipping address',
static::COLUMN_TEMPLATE => 'modules/Tony/OrderSearchChange/order/shipping_address/body.tpl',
static::COLUMN_ORDERBY => 350,
);
First field defines a title of the column, the second field defines a template that will be shown in the table's cell and the third one defines the position of the column (the higher the number the further to the left the column will be).
I have also created a sample module, so you could play with it:
https://dl.dropboxusercontent.com/u/23858825/Tony-OrderSearchChange-v5_2_0.tar
Tony

Capture values of a shuttle list

I am using APex 4.2
I have a page (page 31) with a shuttle list. The list contains several job categories (a, e, x, c, etc). I have a button on that page that generates a report based on the selected job category. I click my button, a query runs, and it takes me to a report page (page 27). The query is along these lines
select * from 'table'
where (instr(':'||:P31_JOB_CATEGORY||':',':'||JOB_CATEGORY||':') > 0)
where P31_JOB_CATEGORY is represented by a shuttle list. This gives me the desired results on page 27, however, is there a way to capture each selected job category that was selected in the shuttle list on page 31 and pass it to page 27 to be displayed? It would be nice to have it stored in a concatenated string of some sort for easy handling, i.e. A, E, C, X.
Any help would be greatly appreciated. Thanks in advance.
The reason is in how shuttle values are saved to session state and how the apex URL is constructed.
Shuttle values are constructed, as you have seen, by concatenating the selected values with a colon. So for example, I have a shuttle on ENAME from EMP, select 3 values and submit the page. Session state for the shuttle is: URUGUAY:HOWARD:M BENZ.
Now say that you redirect to another page, setting an item with the value of this shuttle item. The URL will look like this: f?p=54687:6:100741653098795::NO::P6_TEXT:URUGUAY:HOWARD:M BENZ
The apex URL is constructed by using colons. You putting values in there which has colons simply doesn't work for apex.
Solution? You could submit the page and use a computation to replace the colons, and then branch away to the destination page.
For example, with my enames I'm replacing the colon with a ~: URUGUAY~HOWARD~M BENZ. On your destination page you can then use this value and adapt your sql or use a computation in before/after header to replace the seperator again.

Trigger a process (SQL update) when leaving an APEX page

This is a very odd question but i wondered whether it was possible to trigger a process that runs an SQL UPDATE when the user leaves this specific page, either by clicking on the breadcrumb, tabs or back button?
I did setup the process to run on the 'Back' button; however i ran into the problem of: What if s/he clicks on the breadcrumb or a tab instead.
I have searched the net and posting this question was a last resort. I wondered if anyone can point me in the correct direction?
UPDATED POST
Page 1:
Includes a text field and a button. The user enters the category into the text field and clicks on the button to proceed to the next page. The button passes the value in the text field to a text field on Page 2.
Page 2:
Two regions on the page. One region holds information about the category - Category name from the previous page, category description, and the category revision number (which is what i'm trying to get working). The second region is a report that pulls the item name and number that are listed under the category in the category text field. A 'View' link is used on the report to load the edit page for the specific item selected. The 'View' link passes the 'category name' (from the category text field) and the 'item number' from the report to page 3.
Page 3
Two regions are used, first region: Lists the Item number which came from page 2 and name of the item (which i use a simple query to retrieve). In the second region: A report is used with two columns: a list of item properties in column 1, and a text field next to each item property in column 2 to hold the value that can be updated. The 'Apply Changes' button has some PlSql behind which looks for changes and updates where required. It updates the relevant fields that have changed, and it then takes the user back to Page 2 (Page showing user the items listed for the category intitally entered).
I cant increase the category revision on the 'apply changes' button on page 3 because the user may complete edits for items under the same category. So i dont know where i can increase the category revision by 1 per vist to a category. P.s I already increment the revision number for each item by 1 if the info has been changed using the 'apply changes' button on page 3.
One way of doing this is by updating the session state of the page items (without submitting the page as normal) via ajax and by calling an Application Process which updates the table, when called by a javascript onbeforeunload.
Create an Application Process to fire On Demand, named UpdatePageXOnExit or something. In the PL/SQL block of that Application Process, use SQL update commands with the item state of each item on the page that you wish to update; something like the following:
BEGIN
UPDATE table_name SET col1 = :PX_ITEM_1, col2 = :PX_ITEM_2, col3 = :PX_ITEM3, col4 = :PX_ITEM_4, col5 = PX_ITEM_5
WHERE (condition... I would suggest ROWIDs to simplify changes to the
fields of the PK; otherwise you will have to create additional
page items for each field of the PK, then set those items to
the values of the PK when the page loads using a before
header page process, and then use those values in this where
clause like this: where col1 = :PX_ORIGINAL_PK_FIELD_1 AND col2 =
:PX_ORIGINAL_PK_FIELD_2 );
END ;
Go to the page settings for that particular page, and in the JavaScript: Execute On Page Load section, write something like the following:
window.onbeforeunload = updateOnExit;
And in the JavaScript Function and Global Variables Declaration, write something like the following:
function updateOnExit() {
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=UpdatePageXOnExit',&APP_PAGE_ID.);
get.add('PX_ITEM_1',$x('PX_ITEM_1').value)
get.add('PX_ITEM_2',$x('PX_ITEM_2').value)
get.add('PX_ITEM_3',$x('PX_ITEM_3').value)
get.add('PX_ITEM_4',$x('PX_ITEM_4').value)
get.add('PX_ITEM_5',$x('PX_ITEM_5').value)
gReturn = get.get();
get = null;
// Comment out the following line or not, as per the note in the following paragraph
return 'Are you sure you would like to leave the page?';
}
This last piece is the AJAX that updates the session states of the page items on the page that have been changed on the user's end but that haven't been uploaded to the servers end which normally occurs during page submission. Note: If you comment out the return statement, than there will be no warning box that will allow the user to stay on the page. If that is what you prefer, go for it. If you chose to use the warning box, the ajax will execute the page process even if the user chooses to stay on the page.