Dynamic order by with updateable report
I have a region of type sql query (updateable report)
I want to add a dynamic order by clause based on the value of a page item
ie order by nvl(:PX_ORDER, 1)
I can get the dynamic ordering to work using the 'function returning sql query' reqion type but having a little problem with the sql query type above.
nb. Have also tried ORDER BY decode(:PX_ORDER, 2, 2, 1) but no luck.
Thanks Vikas,
I was using column numbers in the decode. Needed to specify the actual column_name including any "" surrounding it.
decode(:PX_ORDER, 2, "COL2_NAME", "COL1_NAME")
works
any ideas on how to dynamically flip the ASC, DESC ordering in a SQL statement?? The 'ASK TOM' note you mentioned above states you should use dynamic query strings if this functionality is required.
Unfortunately updateable report regions can't be created using dynamic query strings.
Similar Messages
-
Picklist printing from Sales Order screen with Crystal Report
When attempting to print a Sales Order, we get a dialog box that allows us to choose either Sales Order or Picklist. Prior to moving to a Crystal Report based report, this dialog box would appear each and every time we tried to print the Sales Order. (Our process requires that we print the Sales Order to our Document Warehouse and then separately print the Picklist to a physical printer.) Now that we are using Cyrstal, the dialog box to select the form appears for the first print job, but when we try to print the other form, we no longer get the option to choose which form to print. The second attempt at printing then defaults to which form we printed first.
Under Print Preferences, it appears the box to "Print Picking Sheet" only applies to PLD. Other than closing out of the Sales Order Form and opening it back up again, is there a way to force SAP to allow me to choose which form to print each time I click Print?
And since we're on the topic, Is it possible to set up a print sequence to print the Sales Order to one printer and the Picklist to another one?Are you on SBO 8.8 yet? If so which patch level?
There is a Print Sequence functionality built into this version (although we don't use it at our company at the moment). 8.8 will also allow you to attach Crystal Reports to any document (with a little work) and they will print just like a PLD document (albeit in a Crystal Viewer).
If you are not on 8.8 yet, how are you pulling up the Crystal Report for the the Sales Order? I'm guessing you are using some add-on to do this since the 2007 Crystal add-on didn't really handle document layouts very well.
I can expand on all of this if you want. But I'll need to know what version/patch level of SBO you are on. My company is on 8.8 PL15.
Brent -
Quick QBE - query by example with updateable report ?
Hi,
I'm using the function quick_qbe (thanks a lot to Scott Spendolino) and the report
works fine.
My problem is, what is the easiest way to make this report updateable ?
The report should have an separate column for the edit-icon and link this record to another form page.
It's necessary to create a new column for my table ?
Thanks in advance
HolgerHi Holger -
You do need to create an extra column containing the ID field of the underlying table.
You can then set the link attributes of that column to specify:
1. The page you want to link to; and
2. The ID value to pass to the new page.
The 'edit' page will then use the value you passed to fetch a row from the table in order to populate the page's items.
If you create a Form and Report on a Table using the wizard, you will see how it's done.
Regards,
John. -
Dynamic Order by with user defined Where clause...
Hello!
I have a block based on a table, with no order by set and no where clause.
The block is queryable so users can filter the data to be retrieved.
Each of the columns on the form have a button above which requeries the block, applying the order by (SET_BLOCK_PROPERTY ( 'B12', ORDER_BY, :bc1.h_b12_custom_orderby ); )
The problem is that each time the block is requeried the user definied filter criteria is lost. Is there any way I can get a handle on this and maintain the filtering?
GET_BLOCK_PROPERTY(item, DEFAULT_WHERE); only retrieves the query entered while in design mode so this won't work.
I'm using Oracle Forms 6i, web based. Any suggestions are very much appreciated.
Thanks in advance,
JayMany thanks for your response Hedy,
Below is the procedure I used to achieve this.
I found GET_BLOCK_PROPERTY ( p_block, LAST_QUERY ) worked better than :SYSTEM.last_query. As the first time it is called within a block :SYSTEM.last_query returned the query made in another block - which I'm sure has it's applications.
Thanks again,
Jay
PROCEDURE set_last_query_where ( p_block IN VARCHAR2
, p_where IN VARCHAR2 DEFAULT NULL )IS
l_last_query VARCHAR2(10000);
l_last_where VARCHAR2(10000);
BEGIN
IF p_where IS NULL THEN
l_last_query := UPPER(GET_BLOCK_PROPERTY ( p_block, LAST_QUERY ));
l_last_where := SUBSTR ( UPPER ( l_last_query),
INSTR ( l_last_query, 'WHERE')+6, INSTR(SUBSTR(UPPER(l_last_query), INSTR(l_last_query, 'WHERE')+8), 'ORDER BY'));
ELSE
l_last_where := p_where;
END IF;
SET_BLOCK_PROPERTY ( p_block, DEFAULT_WHERE, l_last_where );
EXCEPTION
WHEN FORM_TRIGGER_FAILURE THEN
ref_raise_ftf;
WHEN OTHERS THEN
ref_others( 'P-SLQW' );
END; -
Use dynamic ORDER BY with DISTINCT in SQL SERVER
DECLARE @OrderBy VARCHAR(100)
SET @OrderBy='DealerCode ASC'
SELECT DISTINCT TOP (10)
d.Id, d.DealerCode,d.AffiliationCode,d.LegalName,d.ShipperCode,d.PrimaryUserId,d.PrimaryContactId,d.Zip,
d.Address1,d.Address2,d.IsActive,u.IsActive,d.City,d.[State],c.Name,u.UserName,d.RegistrationIntiatedDate,
d.RegistrationCompletedDate,
rs.[Description],u.EntityId,dbo.fnGetCheckHours(d.Id)
FROM Dealer d
LEFT JOIN [User] u ON d.PrimaryUserId=u.Id
LEFT JOIN RegistrationSource rs ON d.RegistrationSourceId=rs.Id
LEFT JOIN Country c ON d.CountryId=c.id
LEFT JOIN ShippingNote sn ON d.Id=sn.DestinationId
LEFT JOIN Yard y ON sn.YardID=y.Code
LEFT JOIN Terminal t ON y.TerminalId=t.Id
WHERE t.Id='9a77168f-e5b6-4dd0-b26e-f95249c8e189' AND sn.destinationtype='Dealer'
ORDER BY +'d.'+@OrderBy
But I am getting below error:
Msg 145, Level 15, State 1, Line 4
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
I am also using CASE but again I got above error
Please suggest.
I Waiting for your valuable response.
Hey Naunihal Maurya,
Appropriate forum for your question is called
"Transact-SQL"
link for this forrum:
http://social.technet.microsoft.com/Forums/en-us/home?forum=transactsql&filter=alltypes&sort=lastpostdesc
Please Mark This As Answer if it helps to solve the issue
Tzuri Ben Ezra | My Certifications:
CompTIA A+ ,Microsoft MCP, MCTS, MCSA, MCITP
|
FaceBook: Tzuri FaceBook | vCard:
Tzuri vCard |
Microsoft ID:
Microsoft Transcript
| -
Report with dynamic order by (binding of parameter)
hy,
my problem is the following:
i want to let the user customize the ordering of a portal report.
but the binding does not really work, the bind variable seems to
have no effect in the order by clause.
code sample:
select * from SCOTT.EMP order by :p_order
then, portal gets the right value for the parameter:
:p_order binding with HIREDATE
but: this results in an emp table sorted by the empno.....
and not by the hiredate
do you have any ideas how to get this working ???
thanx, martin allhoffHi, the way to do this is to pass in a different set of
parameters. Try not using the :bind parameter in the report
query, but instead, call your report like this:
http:// ... /pls/portal30/Schema.report.show?
p_arg_names=_ORD_BY_COL&P_arg_values=HIREDATE
then try calling
http:// ... /pls/portal30/Schema.report.show?
p_arg_names=_ORD_BY_COL&P_arg_values=EMPNO
to see if indeed it is dynamically selecting the order by clause
based on the info passed in. Also, check my syntax, I cant
remember if ORDBY_COL is correct or not. But any possible
options should be listed for you in the "Display Call Interface"
screen for the report. -
Dynamic Order By on Report Builder 10g
Hi,
How can I do a dynamic order by clause using user parameters on Report Builder 10g? I need to set dynamically the column and the direction on the clause.
Thanks.
Bruno Galletti
Brazil.Hi Bruno / Rainer,
I am implementing the same solution, and after adding the lexical parameter reference in the SQL statement and calling the report from Oracle Forms the report failed with the following error on the report server:
Terminated with error: <br>REP-300: missing expression select wcsr_no , wcsr_date , wcsr_rec_week_zone , wcsr_loc_house_num || ' ' || wcsr_loc_pre_dir || ' ' || wcsr_loc_street_name || ' ' || wcsr_loc_street_type || ' ' || wcsr_loc_post_dir || ' ' || wcsr_loc_unit || ' ' || wcsr_loc_city || ' ' || wcsr ==>
No change has been done to the SQL statement except adding the &p_orderby parameter at the end of the query.
Any suggestions? Are all parameters defined as "bind" parameters on the Repotr Object Navigator.?
Thanks
Gabriel Aguirre
[email protected] -
Standard report(for open PO order items) with estimated Delivery dates
hi friends
i would like to know if there is any standard report(for open PO order items) with estimated Delivery dates on it.
thanks
alahariME2M (by material)
ME2L (by vendor)
ME2N (by number)
Use selection parameter WE101 for open GR
and scope of list EINT (scheduling lines) -
Setting fields defined in SQL updateable report with a process
I have SQL statement defined in a SQL updateable report with hidden fields. I want to be able to update these hidden fields with values from other displayed fields on the page. How do I reference these hidden items - I have referencign them as :my_field but get and error telling me thats its underfined.
But, the reason I am doing this is because I want to format the page with 6 columns in one <TD> cell with some extra text and formatting etc - I don't want 1 column per <TD>. Thats why I am using the APEX_ITEM.TEXT so I can format the 1 <TD> the way I want it (with 6 columns it there).
In the short term can you tell me how to reference hidden fields please.
I will create the case in apex.oracle.com in the next few days to make it clearer.
P.S. see my previous post: SQL QUERY updateable report with APEX_ITEM fields to update hidden columns -
Do we have standard report to show sale order stock with amount?
Do we have standard report to show sale order stock with amount?
I try to use MB5B and MBBS but they don't show value.
MB5B show only qty
MBBS no any report.
Please kindly help.
Thank you very much.Okay Thank you very much for your suggestion.
I think I have to create a new ZProgram. T_T -
Sales orders Dispatch Actual No of pipes do not match with R3 report
Dear Gurus,
Looking Ur assistance for an issue.
Issue: For some of the sales orders Dispatch Actual No of pipes do not match with R3 report. Actual No of Pipes matches with LIKP table values in R3. Query needs to be modified to restrict records as per logic in WGSRLDES report/program.
Can U help me in this Regard.
Ur Responses are most appreciated.Hey Pathak,
The problem is, BI report is matching with the datails with R/3 LIKP table. But the business user is using Report WGSRLDES report/program, where the data is missmatching.
Hope U got my Point. -
SQL Query updateable report with row selector. Update process.
I have a SQL Query updateable report with the row selector(s).
How would I identify the row selector in an update process on the page.
I would like to update certain columns to a value of a select box on the page.
Using the basic:
UPDATE table_name
SET column1=value
WHERE some_column=some_value
I would need to do:
UPDATE table_name
SET column1= :P1_select
WHERE [row selector] = ?
Now sure how to identify the [row selector] and/or validate it is checked.
Thanks,
BobI don't have the apex_application.g_f01(i) referenced in the page source...In the page source you wouldn't find anything by that name
Identify the tabular form's checkbox column in the page(firebug/chrome developer panel makes this easy)
It should be like
<input id="..." value="" type="checkbox" name="fXX" >we are interested in the name attribute , get that number (between 01 and 50)
Replace that number in the code, for instance if it was f05 , the code would use
apex_application.g_f05
--i'th checked record' primary keyWhen you loop through a checkbox array, it only contains the rows which are checked and it is common practice to returns the record's primary key as the value of the checkbox(available as the the i'th array index as apex_application.g_f05(i) , where i is sequence position of the checked row) so that you can identify the record. -
Updateable report with javascript calculation
Hi all,
I have an updateable report where the user fills in one column. I then need a simple multiplication based on the user filled in column and another column to populate into the final column.
I have managed to do this using the following javascript in the page header
<script language="JavaScript" type="text/javascript">
<!--
function calcit(pThis)
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
html_GetElement('f03_'+vRow).value = html_GetElement('f02_'+vRow).value * html_GetElement('f01_'+vRow).value;
//-->
</script>Column f01 is a value in a table based on the SQL to create the report (AQLSCORE)
Column f02 is what the user fills in (AQLERRORS)
Column f03 is where the calculation is populated (AQLTOTAL)
With AQLERRORS element attribute = onchange="calcit(this);"
The problem I am having with the above is that it only works when f03 is a text field (i.e. the user can change the value) I would like the column to be non-editable (the user should not be able to change this field). If I make the column Display as text (saves state) the calculation returns a NaN error.
When I change the calculation from a * to a + the value returned is 1undefined showing that the value from f01 is undefined
Demo app
http://apex.oracle.com/pls/apex/f?p=15328
username: demo
password: demo
There are 2 pages one where the calculation is working but with AQLSCORE as a text field and another where it is returning NaN but with AQLSCORE as Display as text (Saves state)
Any ideas how I can perform the calculation and protect the AQLSCORE column from the user
Kind regards,
Alex
Edited by: user10942729 on 30-Jul-2010 08:12Thank you for your response.
I have corrected the code as you suggested however it still causes the same error.
I have very limited knowledge of java and html (probably not a good start I realise) but it seems that the javascript cannot see(??) the value in the AQLScore (f01) column when it is Display as Text(saves state)
If I change the calculation to just make the value = the AQLScore (f01) without the parseInt syntax 'undefined' is returned. With the parseInt 'NaN' is returned.
I will keep looking for an answer
Cheers,
Alex -
PM module report for Order Cost with details of Components
Dear Gurus,
Is there any report in standard SAP to get cost of an Order along with the details of components used with cost.
Thanks.
Shailesh PanchalHi,
Service order , you can go to IW33 , extras -> cost report - planned /actual comparison
production order , you can go to co03 , goto->cost -> analysis
Thanks,
sudhakar -
Updateable report with CHECKBOX - Error in MRU: row= 1, ORA-01403:
Hi All,
Lets say I have a table tab_1 with column return_flg
I have an updateable report - tabular form.
For the return_flg column I have:
I have Tabular Form Element attribs:
Display As Standard Report Column
Default Type No Default
Default
Reference Table Owner - no reference selected
Reference Table Name TAB_1
Reference Column Name RETURN_FLG
But there is no CHECKBOX display type..so I used HTMLDB_ITEM.CHECKBOX in the SQL...
Select ID, .....
HTMLDB_ITEM.CHECKBOX(1,RETURN_FLG) "RETURNED"
from tab_1 where order_id = '1'
How do I get it to update with the MRU?
I get Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-01403: no data found, update TEMP_USER.TAB_1 set "ID" = :b1
Thanks for the help, BillC
Message was edited by:
bcarlis_2000No, I had an updateable report that works great..
Lets say
Select ID, item_name
from TAB_1 where ID = '1'
Updates great!
then added column to the table to track if item was returned.
RETURNED_FLG
changed select of same form to:
Select ID, item_name
from TAB_1 where ID = '1'
HTMLDB_ITEM.CHECKBOX(1,RETURNED_FLG) "RETURNED"
Now, it updates great IF the checkbox is not checked but gives the error if checked.
Maybe you are looking for
-
i buy a mac mini from amazon, and it is registered on another Apple ID, and i need to change it to mine, how can i do that, note that i can't contact the previous owner of this mac, what shall i do to set it under my Apple ID. Thanks
-
Payment processing is temporarily unavailable. Please try again later.
Payment processing is temporarily unavailable. Please try again later. whats hapen?
-
What is the best network for an unlocked Iphone 5?
I have an unlocked IPhone 5. Almost evey network I've been to told me that they don't offer 4G for unlocked IPhones. AT&T said that I have to be on a contract and pay around $90/mo for an unlimited everything. The issue is that I'm not that type of p
-
If i purchase mountain lion can i do 2 installs?
.
-
Multilingual support in ColdFusion
In my application I am using a form which contains around 70 fields , all are in english language.And there is a drop down in the top right corner of the browser which contains a list of around 30 languages like chineese , japanese , russian etc etc.