IN Clause in Report
Hi,
I want to give mutiple parameters in report e.g. my query is select * from dept where departname in (Mutiple Values).
When the report will run, user can enter either one OR mutiple departments....
Thanks
John
Problem Resolved : Please see Metalink Note 62588.1
Similar Messages
-
Just a quick question about Reports 10g, does it support queries using the WITH clause? i.e.
WITH alias as (subquery)
SELECT col1, col2...
FROM aliasI can't find anything on the documentation on the OTN site. Reports 9iR2 croaks with this unfortunately.
Regards,
Steve RooneyThat is what I have had to do. I wanted to use the WITH clause because subquery has to be done twice so that I can perform some arithmetic on the result sets. Using the WITH construct I only need to define subquery once and re-use the result set; as a result the version using the WITH clause runs twice as fast in SQL*Plus as the way I have implemented the inline views.
Thanks anyway.
Regards,
Steve Rooney -
Apex 4.0 Image Buttons to update SQL Where clause of Report?
I made a table called Letters with 1 column in it called Letter and the data in it is simply A,B,C, to H. I made an apex form around this table and then created two image buttons A and B that display above the reporting area b/c i want to be able to click on the A image button and have it update the Where clause for the Letters table to be "Where Letter = A" (so once you click the A button, only the A will appear), same for the B button. I have attached a link to an album of images to show what i'm trying to do to better explain it. I just can't figure out what or how to make it so that the image button can update the where clause. I should note that i am relatively new to Apex and i tried using a dynamic action to do it but can't get this to work.
Link to images of what i have so far-> http://imgur.com/a/guxkd/oracle_apex_40_use_image_buttons
Any suggestions?
Edited by: Brobot on Feb 8, 2011 9:58 PMSince you are using some kind of button(with images or otherwise) , add some attributes to identify them together aswell as uniquely.
For instance if you add a name and an a common classname to each button
For example, in button attributes for A this could be
name="A" class="where_clause_button"You can use these attributes to trigger a Dynamic action which can refresh the report.
Since you want the report to be filtered based on the button(ie using the "name" attribute of the corresponding button) , you need to set that value in some hidden item, say P100_FILTER_LETTER. and add a where clase to your Report Region' SQL Query
WHERE <column name> = :P100_FILTER_LETTERNow create a Dynamic Action as
Event :Click
Triggering Element : jQuery selector
Selector : *.where_clause_button*
<li>True action 1 : Execute Javascript code
filter_item_name = 'P100_FILTER_LETTER'
this_button_name = $(this.triggeringElement).attr('name');
//Set session state of Hidden Item before refresh
var ajaxRequest=new htmldb_Get(null,$v('pFlowId'),'null',$v('pFlowStepId'));
ajaxRequest.add( filter_item_name ,this_button_name );
var ajaxResult=ajaxRequest.get();<li> True Action 2: Refresh
Affected Element: Region
Name : Choose Report Region Name
Hope it helps -
Getting duplicates in Case and Count clause in Report Generation
Hi all,
let me explain the Base first (just the Section which is in the scope of this code )then ill go to code and my problem.i have a Set of Pre-defined Tasks in *"TASK"* Table.i have a system which will provision the User Request by allotting the Particular Task to their Request.Each Request will mapped to the Instance of the (Pre-defined)Task, this will be maintained in a separate table *"TASK_INSTANCE"* against the user request id. Each task has a pre-defined duration.and their date of completion date will be stored in column of data type Time Stamp.
My scenario is i need to generate report based on the completion date.report requirement is , i need to give the count of tasks which having completion date as today,tomorrow and next day they grouped based on Task Names.
my problem is, im getting duplicates though i used the Distinct.There is no possible of duplicates by means of join, since im using group by task name.each Record in the Task_instance table has direct relation to the Task ID. For eg : im getting one row with the count satisfying the Condition and next row with empty set.i cant figure it out why happening.need your help in figuring out this.
Let me append the query below,
SELECT task.task_name,
*(CASE*
WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
-1)
THEN
*(COUNT (task_instance.ptd_pdd_date))*
END)
AS "1_day_behind",
*(CASE*
WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
-2)
THEN
COUNT (task_instance.ptd_pdd_date)
END)
AS "2_day_behind",
*(CASE*
WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
-3)
THEN
COUNT (task_instance.ptd_pdd_date)
END)
AS "3_day_behind"
FROM task, task_instance
WHERE task.task_id = task_instance.task_id
AND task_instance.status_id = 1
AND task_instance.ptd_pdd_date IS NOT NULL
GROUP BY (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)),
task.task_name;
task_instance.status_id = 1 it refers to the task which are in "IN PROGRESS" state.
This is the (Sample) result set i am getting.In this, the task UI_Contact_Customer is repeated three times. with different count in separate rows and null in separate row .i need to avoid those duplicates.please advise.
TASK_NAME | "1_DAY_BEHIND" | "2_DAY_BEHIND" | "3_DAY_BEHIND" |
______________________________|________________|_________________|_________________|
UI_Conduct_Fiber_Plant_Survey_____|________________|________________ |_________________|
UI_Conduct_Site_Survey__________ |_______________ |________________ |_________________|
UI_ConductFiberSurvey_C___________|________________|________________ |________________|
UI_ConductSiteSurvey_C __________|________________|_________________|_________________|
UI_Contact_Customer_____________|________________|_________________|_________________|
UI_Contact_Customer ____________ |_______10_______|________________ |_________________|
UI_Contact_Customer_____________|________________|_______ 12_______|_________________|
UI_Create_Account_Equip_C_______ |________________|_________________|_________________|
UI_Create_Account_Equipment_____ |________________|_________________|_________________|
UI_Create_CM_Ticket | | | |
______________________________|________________|_________________|_________________|
In the Above result set, especially UI_Contact_Customer task,ten of their instance having completion date tomorrow and 12 instance having next day as completion date. i need get all those as single row without any duplicates.
Thanks,
Jeevanand.Khey super dude,
it really works fine.matching my requirement exactly.
My hearty appreciation to you friend, and a small appreciation for me tooo,because i formed the base query. :-)
i used the below query,it requirement gets completed.
A big Thanks for your super fast Response
SELECT task.task_name,
COUNT(CASE
WHEN TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date) BETWEEN 1
AND 14
THEN
*1*
END)
AS "TWO weeks older",
COUNT(CASE
WHEN TRUNC (SYSDATE) - TRUNC(task_instance.ptd_pdd_date) =
-1
THEN
*1*
END)
AS "1_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -2)
THEN
*1*
END)
AS "2_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -3)
THEN
*1*
END)
AS "3_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -4)
THEN
*1*
END)
AS "4_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -5)
THEN
*1*
END)
AS "5_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -6)
THEN
*1*
END)
AS "6_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) >= -7)
THEN
*1*
END)
AS "After one week"
FROM task, task_instance
WHERE task.task_id = task_instance.task_id AND task_instance.status_id = 1
GROUP BY task.task_name;
Thanks,
Jeevanand.K -
Report did not shown by report_desformat=SPREADSHEET option
Hello,
I am using forms version: 10.1.2.0.2 and reports version: 10.1.2.0.2. I want to call report from form with desformat=SPREADSHEET. I also need to pass default where clause to report.
I was using this code to show report:
web.show_document ('/reports/rwservlet?swtxls&report=SWT_FI_001e.rep¶mform=yes&whre='||whre,'_blank');
It was working fine as showing first parameter form and asking to save it or open it dialog.
But now i want to do it by SSO mode as follows:
if nvl(to_number(instr(:system.last_query,'WHERE')),0) = 0 then
whre := null;
else
whre := replace (substr(:system.last_query, instr(:system.last_query,'WHERE')),'(','( trim(');
whre := replace (replace (whre,'=',')='),'LIKE', ') LIKE' );
whre := replace(replace (whre,'%','*'),' ','&');
end if;
-- whre gets the value as: WHERE&(&TRIM(COL_val)='ABC')
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
pl_id := Create_Parameter_List('tmpdata');
Add_Parameter (pl_id,'whre',TEXT_PARAMETER,whre);
-- Find the id of the Reports Object in Forms
RepId := find_report_object ('REP_FI_001E');
set_report_object_property (RepId, report_destype,cache);
set_report_object_property (RepId, report_desformat, 'SPREADSHEET');
set_report_object_property (RepId, report_server, rep_srvr);
set_report_object_property (RepId, Report_other, 'Paramform=yes');
v_rep := run_report_object (RepId, pl_id);
Rep_status := report_object_status (v_rep);
while rep_status in ('RUNNING', 'OPENING_REPORT', 'ENQUEUED') loop
rep_status := report_object_status(v_rep);
end loop;
if rep_status = 'FINISHED' then
web.show_document ('/reports/rwservlet/getJobId' ||substr(v_rep, instr(v_rep,'_',-1)+1) || '?server='|| rep_srvr,'_blank');
else
set_alert_property('err',alert_message_text,'Error when running report: Rep_status= '||rep_status);
al_button := show_alert ('err');
end if;
Report executing fine and i can see it in oracle_Home\reports\cache\ directory in html format. But i am not able to see on screen.
Even if i mentioned DesName in "After Parametr Form" trigger in report as c:\data_output\abc.xls, i can't have this report in the mentioend directory.
Can any one help. Will really appriciate.
Thanks in advance
Best Regards
Kausar.set_report_object_property (RepId, report_destype,cache);You are creating the file in the cache. If you want a specific file (c:\data_output\abc.xls), use file as destype.
-
I have a very complex and large report that runs extremely slow. I have always just put the sql in the data model and run it there. Does using a refcursor or some other method run faster as a general rule? It is taking 5+ minutes for a couple of lines of data that equate to about 6 - 10 pages. When I run the same queries from the command line the data is returned in less than 30 seconds.
Thanks
AndyOne thing we found is if you are using bind parameters in the where clause the report often does not use any indexes (but when you convert to sqlplus you don't have bind parameter and hence runs quicker). Try using lexicals instead
-
Ora-20001 when creating a form on table with report (bug?)
Having some trouble creating a "Form on table with report".
1) I pick my table
2) take most of the defaults on the page where you pick the report type (interactive) and the page number (I changed it to 950). next->
3) Do not use tabs. Next->
4) Select all columns for the report. THEN (here's the problem) set an optional where clause of system_role_name like 'ODPSPOPUP%'. Next->
5) choose standard edit link. next->
6) Specify a page of 951 for the form (leave others defaults). next->
7) Set the form primary key (defined in table). next->
8) use existing trigger. next->
9) choose all columns for the form. next->
10) Leave actions to insert, update, delete. next->
11) Get to the summary page and click Finish
Then I get an error page saying:
ORA-20001: Unable to create query and update page. ORA-20001: Unable to create query and update page. ORA-00933: SQL command not properly ended
If I go back to step 4 and erase my where clause the wizard completes successfully.
Also if I change the report type in step 2 from the default of "Interactive" to "Classic" the wizard completes successfully. However upon running the report I get a query parse error. Looks like the where clause in the report sql is: system_role_name like ''ODPSPOPUP%'' (two single quotes on each side).
It looks as if you cannot specify a where clause with a quoted string. The wizard is expecting a bind variable.
Workaround(s):
1) Don't specify a where clause when report type = Interactive in "create form on table with report" wizard.
or
2) Specify a bogus where clause using bind variable syntax such as "system_role_name like :BOGUSVARIABLE". Then edit the report query once the wizard finishes and change the where clause to the constant string you wanted to use in the wizard (e.g. "system_role_name like 'MYSYSTEM%'")
Apex: 3.2.0.00.27
Database: Oracle Database 11g Enterprise Edition 11.1.0.7.0 64bit Production (Oracle EL5)Andy,
It's a bug, all right. Thanks for the detailed problem description. We'll fix it when we can.
Scott -
Dynamic Reports. Runtime parameter passing to Report Query.
Hi everyone,
I have developed a report using apex shared components (report query and report layout) along with BI Publisher for report printing in pdf format. the Report template is built using Template Builder for Word. I have configured my Apex4.1 env with BI Publisher 11.
This report is working fine for hardecode ID ( like REQUEST_ID=10 ).
to make report dynamic i have made following additions in the report
I have added
where clause in report query as WHERE REQUEST_ID = :REQUEST_ID (:REQUEST_ID is the text field in my page).
Added a text field names :REQUEST_ID to get user input at run time.
Create a button and add Repot Query URL in its properties.
When i run the report with some valid value in :REQUEST_ID text field i did not get expected result infect there is no record getting displayed in the PDF file.
i think this is not the write way to do this but interestingly im not getting any error.
please can someone guide me that how can i get this functionality in apex this way or the other ?
Best Regards.Hi,
the online help will help you on how to build a parameter list at all. For your desired functionality, all you need to do is to have the user pressing a button after he selected the parameters he want to assign values to and then create the parameter list in a PSLQL program unit in Forms.
Frank -
How to pass date in SQL Report
Hi All,
I am trying to create a SQL report which contains the following in the where clause:
and A.RESP_DATE >= to_date('01/01/2010','MM/DD/YYYY')
BIP does not seem to like this and is not processing the report. If I remove this clause the report is running but I want to limit the number of records that are being returned.
I wanted to find out which date format should be used to pass the SQL query.
TIA,
RamkumarHi ,
where clause with date will wrk in bip.
Check the same query in sql..if it is wrking means it will wrk here also.
(A.RESP_DATE) whats ur actuall format of this column.
Thanks,
Ananth -
Can i assign an 'order by' clause dynamically in forms ??
I know it's possible to assign an 'order by' clause in reports with lexical parameter.
for example..
select A
from TABLE
where A is not null
&V_ORDERBY
In this, v_orderby might be 'order by name' like that,,,
can i assign an 'order by' clause dynamically IN FORMS ??
If you understan my question, please answer to me,,,ㅜㅜHave you tried this build-in function?
SET_BLOCK_PROPERTY('[BLOCK_NAME]', ORDER_BY, 'SORTCOL1, SORTCOL2...');
Where 'SORTCOL1, SORTCOL2...' are the table columns name. -
Parameter in form for dynamic query in report
Hello,
I want to send parameters to report for replacing a dynamic query. I don't know how to make it...
1.I want my select statement like
select * from emp
&p_where_clause
2.I want to transfer parameters to report to replace the &p_where_clause.
3.I know I should create a parameter list first, and then use add_parameter built-in to add the parameter, but what I don't know is the correct format of the add_parameter statement.
4.I know the common format is add_parameter(paramlist,'TEXT_PARAMETER',value) , is it the same format if I want to transfer a select statement to report such as "where deptno in ('25','28','30')" for replacing &p_where_clause in report?
Thanks in advance
JosephI appreciate your reply, but I am still a little confused...
Actually, I want to pass the where clause to report by different condition. Such as when the user choose the deptment 1, then I can transfer the "where dept_no = '1' and empno > 500", or user choose the deptment 2, I can transfer "where dept_no = '2' and company = '0001'". What I want is to pass different where clause to report according to different condition.
So is it right the statement should be like
DECLARE
vWhere1 varchar2 := 'where dept_no = "1" and empno > 500';
vWhere2 varchar2 := 'where dept_no = "2" and company = "0001"';
BEGIN
IF choose = 1 THEN
ADD_PARAMETER(&P_WHERE_CLAUSE, TEXT_PARAMETER, vWhere1);
ELSIF choose = 2 THEN
ADD_PARAMETER(&P_WHERE_CLAUSE, TEXT_PARAMETER, vWhere2);
END IF;
END;
THANKS AGAIN!!
Joseph -
I feel sure there will be an easy way to do this...
My applications uses email a lot to communicate with customers. Until now we have used plain text, and we'd like to jazz it up a bit by sending HTML format instead.
But rather than re-code all the messages that are currently generated by PL/SQL functions, I think we could generate the content we need via SQL reports, and get all that neat formatting done for nothing. We might have to splice in a salutations and a signature. But the main stumbling block is that I don't want to make customers have to open an attachment when the content could be embedded in the email itself.
But how can I intercept the html report output and utilize it as an input parameter to the apex_mail procedure, which is already receiving to/from/subject and every other parameter it needs from the existing processes and just needs this one extra chunk of nicely formatted dynamic content?
Any suggestions would be most welcome, because I'd much rather be getting on with version 4 conversion than handcoding HTML!
Thanks and regards
CSI presume; unless I can refer to the receiving region using substitution string syntax when invoking the send_mail procedure - can that be done?On click of 'Send Mail' button or similar button, call JS function. In the JS function, make AJAX call to fetch report region content. It will make background call to the page and fetches the page HTML dynamically. If you have any page item in where clause of report query, you can also set the value of items using AJAX object.
Does the get.get actually trigger the report execution and THEN return the output, or does it assume the report has been run previously? Yes, it actually triggers report execution.
Pseudo code
<script>
function fnPullReport(pPageNo,pStartTag,pEndTag)
// Ajax object to pull content from page vPageNo
var vAjaxObj = new htmldb_Get(null,$v('APP_ID'),null,vPageNo);
// Insert filter item values, if any
vAjaxObj.add('P10_FILTER1',<Filter Value>); //Assuming your report is using P10_FILTER1 in WHERE clause
vReturn = vAjaxObj.get(null,pStartTag,pEndTag); // fetch the report content dynamically
$x('P1_REPORT_HTML').value = vReturn; // Save report HTML to page hidden item
doSubmit('SEND_MAIL'); // submit page with SEND_MAIL request
</script>Write a page process to send mail and use P1_REPORT_HTML to get report HTML value.
Hope it helps :)
Cheers,
Hari
Edited by: Hari_639 on Jun 27, 2010 1:32 PM -
Hi,
Given below should be the webi output:
Emp No, Emp Location, Emp Name, Seniority Date,Curr_Year_Rating,Prev_Year_Annual_Sal_at_April_1st,current Annual_Sal_at_Jan_01
I am using the formulas for these columns: Curr_Year_Rating,Prev_Year_Annual_Sal_at_April_1st,curr_ Annual_Sal_at_Jan_01
Curr_Year_Rating
([Rating] Where(Valid From Date - PK <= January 1st, 2014 AND Valid To Date >= January 1st 2014))
(ii) Prev_Year_Annual_Sal_at_April_1st
([EMPL ADMIN - Salary Yr] Where(Valid From Date - PK <= April 1st, 2013
AND Valid To Date >= April 1st 2013))
(iii)curr_Annual_Sal_at_Jan_01:
([EMPL ADMIN - Salary Yr] Where(Valid From Date - PK <= January 1st, 2014
AND Valid To Date >= January 1st 2014))
Is it ok to use current and previous year formulas for an employee record?
Can I use if then formula instead of Where clause formulas in the above 3 formulas?Have you validated all the formulas. As I could see in formulas you have and condition in where clause which is syntax error.Where clause at report level only take one condition. Try to use If condition for "Valid From Date - PK <= January 1st, 2014 AND Valid To Date >= January 1st 2014" with 1 and 0 flag.And use new variable and put value equal to 1 in where clause.
-
Error when including hierarchical column in repot
Hi All,
I am getting following error [nQSError: 42039] Columns in BY clause of REPORT totalling function must be in select list. (HY000) when i include the Hierarchical column, Is it something i should set for it.
Thanks,
SreekanthHi,
Problem was not with hierarchy column, but with another column which i used to sort the entire report on (fiscal_priod_number), and fiscal_period_number column was in excluded section in the pivot, once i dragged the column to pivot section and hide it from colum properties hide property report is functioning normally, This is something intresting behaviour, and this happens only with reports which use hierarchy column.
Thanks,
Sreekanth -
Internal error [78601]
Hello,
I am getting this Error when I use the LIKE clause in Reports Program UNIT.
For example.
if fpi_mfg_pkg.g_mfg_tbl(i).line_type like '01%' then
:P_01_LINE_TYPE := fpi_mfg_pkg.g_mfg_tbl(i).line_type;
END IF;
If I replace "LIKE" with "=" then it works fine. Is "LIKE" a restricted clause. This is the version, I am running.
===
Report Builder 6.0.8.27.0
ORACLE Server Release 8.0.6.3.1
Oracle Procedure Builder 6.0.8.21.0
Oracle ORACLE PL/SQL V8.0.6.0.0 - Production
Oracle CORE Version 4.0.6.0.0 - Production
Oracle Tools Integration Services 6.0.8.18.0
Oracle Tools Common Area 6.0.8.18.0
Oracle Toolkit 2 for Windows 32-bit platforms 6.0.8.25.0
Resource Object Store 6.0.8.21.0
Oracle Help 6.0.8.25.0
Oracle Sqlmgr 6.0.8.18.0
Oracle Query Builder 6.0.7.1.0 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle ZRC 6.0.8.22.0
Oracle Express 6.0.8.3.5
Oracle XML Parser 1.0.2.1.0 Production
Oracle Virtual Graphics System 6.0.5.38.0
Oracle Image 6.0.8.25.0
Oracle Multimedia Widget 6.0.8.25.0
Oracle Tools GUI Utilities 6.0.8.25.0NO harm to run those again ..
Maybe you are looking for
-
Steps to upgrade BI apps RPD from 7.9.60 to 7.9.6.3
If anyone successfully upgraded RPD from 7.9.6.0 to 7.9.6.3 and merged the RPD, please let me know the steps to follow. Thanks,BI Apps
-
Hi I am getting huge buffer busy waits events on my database and its increasing following is the result of query on my database(9.2.0.8.0) SQL> select event,total_waits from v$system_event where event in ('free buffer waits','buffer busy waits') 2 ;
-
Issue with full screen apps quitting
I am having problems when I exit a full screen app on OSX Mountain Lion!!! It does't happen all the time but when it does the only way I could fix it is log out and log back in!! The problem is when I quit a full screen app the desktop it created to
-
Export pdf how to edit and save converted files
I finally was able to convert to docx format, but see no way to use the converted file. How can I edit and save in jpeg format?
-
Could not read detail log from DB12 and DB13
hi gurus, I am unable to read detail log of onlinebackups and Redolog backups from DB12 and DB13 in my BI sytem what could be the problem. cheers Kumar