Query multiple selection crieteria
Hi All ,
Is it possible to restrict the selection with some data begins with 1* AND 2* AND 3* . while selecting from a table when creating a query .
Thanks & Regards ,
Sabu.
Hi,
If you are doing from the ABAP prog. You can do as
*select * from table where field like '1%' or field like '2%' or field like '3%'.*
You can do the same while creating query through SQVI.
Thanks & Regards
Similar Messages
-
Multiple Select List looping thru PL/SQL function body returning SQL query
Hi,
I have a Multiple Select List. I want to loop through the values from the Select List and process them in a PL/SQL function body returning a SQL query. Currently, my code only returns the SQL SELECT results of one item in the select list. How do I change my code to make it return the results of all of the items in the select list? (I tested it and it is definitely picking up all the values in the select list).
<b>
DECLARE
selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
s VARCHAR2(20);
q varchar2(32767);
BEGIN
selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
-- htp.p('COUNT: '||selected_items.count);
FOR i in 1..selected_items.count LOOP
s := TO_CHAR(selected_items(i));
-- htp.p('First: '||s);
-- htp.p('Second: '||:s);
-- htp.p('Third: '||TO_CHAR(selected_items(i)));
q:= 'SELECT '||
'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
'sum(orig_intrl) orig_intrl, '||
'sum(orig_extrl) orig_extrl, '||
'sum(recv_intrl) recv_intrl, '||
'sum(recv_extrl) recv_extrl '||
'FROM line_usage_sum_view '||
'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
--'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
'AND '||
:SORTFIELD||' BETWEEN '||
'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
-- htp.p('SQL query: '||q);
RETURN q;
END LOOP;
END;</b>
Thank you,
LauraLaura,
First, I would be careful of introducing SQL Injection possibilities. Any time I see
'Select ... ' || :P123_FOO || ' ... '
I worry about sql injection. In your case you are converting :P50_SELECTED_INSTRUMENTS into selected_items and then selected_items into s. So when I see
'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
I think, "I could use sql Injection and hack this."
So, I would do some validation on :P50_SELECTED_INSTRUMENTS or some other method to avoid this.
I'm not certain I understand your query. Do you really intend to allow the user to select the beginning of a string and then find all rows that start with that string? Or, do you just want to let them find when it matches the string. This is one way if you want to do matching:
DECLARE
selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
s VARCHAR2(32767);
q varchar2(32767);
BEGIN
-- Change the : separate string to be comma separated with quoted strings
s := '''' || replace(:P50_SELECTED_INSTRUMENTS, ',', ''',''')|| '''' ;
-- htp.p('COUNT: '||selected_items.count);
q:= 'SELECT '||
'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
'sum(orig_intrl) orig_intrl, '||
'sum(orig_extrl) orig_extrl, '||
'sum(recv_intrl) recv_intrl, '||
'sum(recv_extrl) recv_extrl '||
'FROM line_usage_sum_view '||
'WHERE TO_CHAR(orig_geo_loc_sys) in (' || s ||' ) '||
--'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
'AND '||
:SORTFIELD||' BETWEEN '||
'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
-- htp.p('SQL query: '||q);
RETURN q;
END;
If you want to do something more like you originally stated, try this:
DECLARE
selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
s VARCHAR2(20);
q varchar2(32767);
BEGIN
selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
-- htp.p('COUNT: '||selected_items.count);
q:= 'SELECT '||
'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
'sum(orig_intrl) orig_intrl, '||
'sum(orig_extrl) orig_extrl, '||
'sum(recv_intrl) recv_intrl, '||
'sum(recv_extrl) recv_extrl '||
'FROM line_usage_sum_view '||
'WHERE 1=1 ';
FOR i in 1..selected_items.count LOOP
s := TO_CHAR(selected_items(i));
q := q || ' and TO_CHAR(orig_geo_loc_sys) LIKE '''|| s ||'%'' ' ;
END LOOP;
q := q || ||'%'' '||
--'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
'AND '||
:SORTFIELD||' BETWEEN '||
'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
-- htp.p('SQL query: '||q);
RETURN q;
END;
Hope this helps...
Anton -
Interactive Reporting - Multiple SELECT stmts in 1 query
Is it possible to multiple/nested select statements in 1 query? Actually what I need to do is pull records for the last 12 months. The SQL that I'm basing my IR query from has multiple SELECT statements and uses the add_month function w/ a parameter ranging from 0 to -12.
Thanks.
TerriHere's some of the additional SELECTs. There are more after these that I didn't include since it would be fairly long.
CREATE OR REPLACE VIEW DEFECT_INVENTORY
(NEW_COUNT, CLOSE_COUNT, BEGINNING_COUNT, ENDING_COUNT, MONTHNAME,
SEVERITY)
AS
select New_Count, Close_Count, Beginning_count, Ending_Count,r.Monthname, r.Severity from
(select p.New_Count, q.Close_Count,p.sev Severity, p.Month_Name Monthname from
(Select count(bg_bug_id) New_Count,a.Month_Name, a.sev
from
(select bg_bug_id,
bg_severity sev,
bg_user_10 app,
bg_detection_date,
bg_closing_date,
to_date(bg_user_26, 'yyyy-mm-dd') as cancel_date,
to_date(substr(bg_vts,1,10), 'yyyy-mm-dd') as vts,
to_char(to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1, 'MON-YY') as Month_Name,
bg_status,
to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1 AS rpt_DATE_end,
to_date((to_char(add_months(sysdate, -12), 'MM')||'/01/'||to_char(add_months(sysdate, -12), 'YYYY')), 'MM/DD/RRRR') AS rpt_DATE_beg
from bug ) a
where (a.bg_status not like '65-Cancelled'
and a.bg_detection_date <= a.rpt_DATE_end
and a.bg_detection_date >= a.rpt_DATE_beg
and a.cancel_date is null)
group by a.sev, a.Month_Name) p,
(Select count(bg_bug_id) Close_Count,a.Month_Name, a.sev
from
(select bg_bug_id,
bg_severity sev,
bg_user_10 app,
bg_detection_date,
bg_closing_date,
to_date(bg_user_26, 'yyyy-mm-dd') as cancel_date,
to_date(substr(bg_vts,1,10), 'yyyy-mm-dd') as vts,
bg_status,
to_char(to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1, 'MON-YY') as Month_Name,
to_date((to_char(add_months(sysdate, -12), 'MM')||'/01/'||to_char(add_months(sysdate, -12), 'YYYY')), 'MM/DD/RRRR') AS rpt_DATE_beg,
to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1 AS rpt_DATE_end
from bug ) a
where (a.bg_status like 'Closed'
and a.bg_closing_date <= a.rpt_DATE_end
and a.bg_closing_date >= a.rpt_DATE_beg
and a.bg_closing_date is not null)
or
(a.bg_status like 'Closed'
and a.vts <= a.rpt_DATE_end
and a.vts >= a.rpt_DATE_beg
and a.bg_closing_date is null)
or
(a.bg_status not like 'Closed'
and a.bg_closing_date <= a.rpt_DATE_end
and a.bg_closing_date >= a.rpt_DATE_beg
and a.bg_closing_date is not null)
group by a.sev, a.Month_Name) q
where p.sev = q.sev) r, -
Setting current values in Multiple Select List in SQL Query based Report
Hi,
I have a report based on a sql query that contains a multiple select list. Unfortunately I cannot get the multiple select list to display the current values (p_value) correctly. I have created a page item, :p311_current_versions, that is set using a pre-header process and it returns a value with a colon delimited format e.g. '10.1.2.1.0:10.1.2.2.0'. Then this item is used in the sql query to set the current value (p_value) of the apex_item.select_list_from_query function. However when the table is displayed, instead of having two entries, 10.1.2.1.0 and 10.1.2.2.0 selected, it has an extra entry '10.1.2.1.0:10.1.2.2.0' selected.
Here is my code:
select distinct a.product, a.version from (
select distinct
apex_item.display_and_save(2,product)||apex_item.hidden(1,env_product_id) PRODUCT,
APEX_ITEM.SELECT_LIST_FROM_QUERY(3,decode(product, 'HTTP Server' , :p311_current_versions, version), 'SELECT distinct version d, version r FROM ebs_tech_stack where
product ='''||PRODUCT||'''',
decode(PRODUCT, 'HTTP Server' ,'multiple="multiple" style="width:170px"','style="width:170px"'),
'NO') as version
from ebs_environment_tech_stack
where environment_id = :p311_umgebung_id) a order by a.product
If anyone can help me figure out how to set the current values correctly I'd be really grateful!!
Thanks in advance,
JeanJean,
I don't think this is possible using the apex_item package. The select_list_from_query function accepts only a single value for the second parameter.
Scott -
Report query with multiple selects
On some of my Report Queries (that have multiple selects) it sometimes changes the rowset when I edit the specific SQL.
For example, I have 2 selects in my Report Query andnd when I download the XML my first select’s data goes into <ROWSET1> and my second select’s data goes into <ROWSET2>. I then make my template and everything is good.
But, sometimes when I edit the SQL in the report it changes the ROWSET number of the data so now my first select’s data in ROWSET2. This blows up the report. Is this a bug? Why is it switching the rowsets back and forth?I'm referring to the Report queries under shared components.
My first query is like this:
select A.emp_id
from tab1 AC4, tab2 AC3, tab3 AC2, tab4 AC1, tab5 A
where A.year = :page_year
and C.FK_SCHOOL IN (SELECT c001
FROM apex_collections AC1
WHERE AC1.collection_name = 'SIS_REPORTS_SCHOOLS')
and nvl(C.ACTIVE,'NONE') IN (SELECT decode(c001,'NONE',nvl(C.ACTIVE,'NONE'),C001)
FROM apex_collections AC2
WHERE AC2.collection_name = 'SIS_REPORTS_ACTIVES')
and nvl(C5.CALENDAR_NO,'NONE') IN (SELECT decode(c001,'NONE',nvl(C5.CALENDAR_NO,'NONE'),C001)
FROM apex_collections AC3
WHERE AC3.collection_name = 'SIS_REPORTS_SCHOOL_CALENDAR_NOS')
and nvl(C10.CLUSTER_CODE,'NONE') IN (SELECT decode(c001,'NONE',nvl(C10.CLUSTER_CODE,'NONE'),C001)
FROM apex_collections AC4
WHERE AC4.collection_name = 'SIS_REPORTS_CLUSTER_CODES')
My second query needs to select the detail info from other tables, but I only want to do it for the (master) records that were returned in the first query. -
Multiple selection in Query Panel. Operator Does not equal generates error.
Hi,
I'm using Jdeveloper 11.1.1.4 and creating Oracle Fusion Web Application with ADF Business Components.
I want to use multiple selection on LOV in ADF Query Panel with Table, but I get the following error
when I use operator "Does not equal":
Error: Unsupported model type.
SelectMany does not support a model of type class java.lang.Integer.
A simple example:
Schema: HR
Generate default Business Components for tables Departments and Employees.
Model:
Create List of Values for EmployeesView(DepartmentId)
List Data Source: DepartmentsView1
List Attribute: DepartmentId
Display Attributes: DepartmentName (UI Hints)
Create View Criteria EmployeesByDepartmentVC for EmployeesView
Criteria Item:
Attribute: DepartmentId
Operator: Equals
Operand: Literal
Select "Support Multiple Value Selection" (UI Hints)
ViewController:
Create blank JSF Page: showEmployees.jspx
Drag EmployeesByDepartmentVC from Data Controls to showEmployees.jspx
Create Query=>ADF Query Panel with Table
Run application.
Press Advanced button.
Select operator "Does not equal" and department names "Administration;Marketing"
Press Search
Error: Unsupported model type.
SelectMany does not support a model of type class java.lang.Integer.
Note: it works fine with operator "Equals"
Best,
Kees.Hi,
I was reading:
http://www.oracle.com/technetwork/developer-tools/jdev/jdev-11gr2-nf-404365.html#bugs_fixed_in_11.1.2.2.0
Bugs Fixed in 11.1.2.2.0
Bug.No. 13508184
unsupported model type error thrown for multi select view criteria
I have tested the use case described in this thread with JDeveloper 11.1.2.2.0 but I still get the same error.
when I use operator "Does not equal":
Error: Unsupported model type.
SelectMany does not support a model of type class java.lang.Integer.
Is there anybody who can tell me more about this bug fix?
Thanks,
Kees. -
How to create parameter with multiple selection in a query (SQ02) ?
Hi Exports
Do you know how to create parameter with multiple selection in a query (transaction SQ02)?
thanks.Hi
i know how to create user parameter at SQ02,
the question is how to create multiple selection parameter? -
I'm building a report based on a single table in APEX. The report requires the following.
select user, project, count(start date ), project, count(end date) where date between 01-jan-07 01-feb-07
(simplified to show the idea)
basicaly a count of projects that started between two dates and the ones that ended between the same two dates relating to the user.
I have writen the selects to do both parts and they work BUT is it posible to glue them together in a single statement?
I tried to searching the forum on "multiple selects" but never realy got anything close.
Is it possible to do this type of select? If so does it have a special name (so I can try a search on that name)
Thanks
BjornFirst of all, '11-MAY-06' and '19-MAY-06' are not dates, they are strings. This has some important disadvantages:
1) Oracle has to implicitly convert them to a date, when they are being compared to a date column
2) Your application will be NLS (National Language Support) dependent, so they might break when you change a setting
3) When compared to a varchar2 or other string column, the comparison will give incorrect results. For example: 12-MAY-06 will be between 06-JAN-06 and 18-JAN-06
Bottom line: convert those dates to real dates using the to_date function, or the date 'yyyy-mm-dd' variant.
Back to your question, apparently you don't want to count the number of occurences of CON_ACTUAL_START and CON_SIGN_OFF, but you only want to count them when this date is between the two boundary values. So use the following:
select mli_clo
, count(case when con_actual_start between date '2006-05-11' and date '2006-05-19' then 1 end)
, count(case when con_sign_off between date '2006-05-11' and date '2006-05-19' then 1 end)
...Regards,
Rob. -
Multiple select staement in 1 query
Hell Team,
I am New to this SQL world. Please help me out with htis:-
I have following queries:-
#select name from v\$database;
#select log_mode from v\$database;
#select count(*)"INVALID_OBJECTS" from dba_objects where status='INVALID';
#select count(*) "INVALID_N/A_INDEXES" from dba_indexes where status!='VALID';
#select count(*)"Invalid Triggers" from user_objects where OBJECT_NAME like '%TRIGGERS%' and status='VALID';
#select count(*) "Broken Jobs" from dba_jobs where broken!='Y';
#select count(*) "Block Corruption" from v\$database_block_corruption;
i want a table which can be generated just by select cmd and it will list the result of all the above queires as follow:-
DB_NAME ARCH_MOD INV_OBJ INV_IDX INV_TRG B_JOB BLK_CRP
PROD NOARCHIVELOG 0 86 6 3 0
I mean to say i want multiple select queries into 1 table (note:- i m not saying to create a tables and then insert,update(using select from other tables), its just a sheel script that will fetch these record into a txt file)Something like this ?
SQL> ed
Wrote file afiedt.buf
1 select a.name,
2 a.log_mode,
3 b."INVALID_OBJECTS",
4 c."INVALID_N/A_INDEXES",
5 d."Invalid Triggers",
6 e."Broken Jobs",
7 f."Block Corruption"
8 from
9 v$database a,
10 (select count(*) "INVALID_OBJECTS" from dba_objects where status ='INVALID') b,
11 (select count(*) "INVALID_N/A_INDEXES" from dba_objects where status !='VALID') c,
12 (select count(*) "Invalid Triggers" from user_objects where OBJECT_NAME like '%TRIGGERS%' and status='VALID') d,
13 (select count(*) "Broken Jobs" from dba_jobs where broken!='Y') e,
14* (select count(*) "Block Corruption" from v$database_block_corruption) f
SQL> /
NAME LOG_MODE INVALID_OBJECTS INVALID_N/A_INDEXES Invalid Triggers Broken Jobs Block Corruption
ORCL ARCHIVELOG 1 1 0 3 0
SQL>Now just try to replace your script with this :
#!/bin/bash
export hostname=$2;
echo " export started"
export ORACLE_SID=$1;
export ORACLE_HOME=/$1db/db/10.2.0;
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/lib;
export TNS_ADMIN=/$1db/db/tech_st/11.2.0/network/admin/$1_$2;
PATH=/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/local/oracle/bin:/usr/local/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ucb:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch;
export PATH=$PATH:$ORACLE_HOME/bin;
echo $ORACLE_HOME
echo "all export complete"
#export var1=/$1db/db/tech_st/11.2.0/$1_$2.env
#export var2=/$1db/db/tech_st/11.1.0/$1_$2.env
export var3=/$1db/db/10.2.0/$1_$2.env
#. /$1db/db/tech_st/11.2.0/$1_$2.env
#. /$1db/db/tech_st/11.1.0/$1_$2.env
#./$1db/db/10.2.0/$1_$2.env
sqlplus / as sysdba <<eof
select a.name,
a.log_mode,
b."INVALID_OBJECTS",
c."INVALID_N/A_INDEXES",
d."Invalid Triggers",
e."Broken Jobs",
f."Block Corruption"
from
v\$database a,
(select count(*) "INVALID_OBJECTS" from dba_objects where status ='INVALID') b,
(select count(*) "INVALID_N/A_INDEXES" from dba_objects where status !='VALID') c,
(select count(*) "Invalid Triggers" from user_objects where OBJECT_NAME like '%TRIGGERS%' and status='VALID') d,
(select count(*) "Broken Jobs" from dba_jobs where broken!='Y') e,
(select count(*) "Block Corruption" from v\$database_block_corruption) f;
exit; >>filename.txt
Let us know if it works for you or not.
Regards
Girish Sharma -
Querying for a script insert multiple selected objects...
Is there a script or plugin which insert multiple selected objects in one new text frame with one click?
And is there a script or plugin which extract the content of anchored text frame out it's frame and replace it with it's frame. and extract selected text and insert it inside a new anchored text frame in it's place? (like convert text to table - convert table to text, but instead table we use text frame)Hi,
Using OMB scripting to set attribute properties in a data mapping sort of defeats the purpose of utilizing a graphical user interface to define and set properties for a data mapping? Surely the GUI data mapping tool was created to get away from writing scripts and scripting would also require that you know the name of the data mapping, table operator and the set of attribute names for which you have to write one line of script to set each property value, i.e. 90 lines to set 90 attribute values.
Cheers,
Phil -
How to get all rows that are returned in inner sub query of select statemen
If a sub query in select statement returns more than one row than how to get all those returned rows in the final
output of the query .It will be all right if all column's value repeat and that multiple output of inner query comes
in another column .
How to get that ?As Frank said, you likely want a join, and likely an outer join to replicate the select in the projection. Something like:
SELECT id,stat, section, USER_ID concerned_person
FROM table_all,
left join table2
on room_id = sectoion and
sur_role = 'r001'
WHERE section IN (SELECT code
FROM t_area
WHERE dept= 'p002')An alternative, depending on where and how you are using the statement would be something like:
SQL> WITH t AS (
2 select 1 id from dual union all
3 select 2 id from dual),
4 t1 as (
5 select 1 id, 'One' descr from dual union all
6 select 1, 'Un' from dual union all
7 select 1, 'Une' from dual)
8 SELECT t.id, CURSOR(SELECT t1.id, t1.descr from t1
9 WHERE t1.id = t.id)
10 FROM t;
ID CURSOR(SELECTT1.ID,T
1 CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ID DESCR
1 One
1 Un
1 Une
2 CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
no rows selectedJohn -
How can i display Value in Report which i select from Multiple select list
Dear All,
i am using multiple select List in form with report page.
When i create new Entry with select Multiple value in Multiple Select List then in report Value display me in below format
my SQL Query are
select NAME D, CODE R from COUNTRY_MAS WHERE ACTIVE_FLG ='Y' order by NAME
AS:AI:AG:AM these are return value .i want to display NAME in report .
How can i do this ?
Thanks
Edited by: Vedant on Apr 25, 2012 11:14 PMShort answer, use the apex_util.string_to_table to convert to a table; then you can either iterate through the table to generate a string of names, or accomplish the same with a bulk operation.
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#CHDFEEJD
Encapsulate all this within a pl/sql function. -
Can I make the parameter supports multiple selection and editable at the same time?
Hi,
I am building my report using SQL Server Report builder 3.0. All the parameters are added to the report
by the builder. When the user access the report by browser, he can change the parameter value and click "view report" button to load the report from the database.
For one of the parameter, I want to provide user the ability to select frequently used value as multiple
selection, and meanwhile let them able to edit the value if the preloaded selection doesn't contain what he wants.
Is it possible to archive this goal using report builder?
Thanks!You cant have this functionality using standard report viewer. An approximate work around can be implemented as follows.
Have two parameters one based on your current parameter values (dropdown) and another one without any available values set and default set to NULL (Set Allow Null value property and pass Null as default value). This parameter will appear as disabled textbox
with NULL checkbox checked.
Now in your code behind which gives you first parameter's values Add one more value say <None Of Values> and set value as some default value (-1 if int or just a random string value).
Now in the value for second parameter set a expression like below
=IIF(Parameters!FirstParam.Value ="<Select None>","",Nothing)
This will make sure second parameter gets activated when you select option <none> from first. Then you can type the value you want in it
In query behind just make filter like below
WHERE field = CASE WHEN @Param1 <> '<None>' THEN @Param1 ELSE @Param2 END
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Multiple Select List does not Refresh with Dynamic Action
All,
Scenario:
Using APEX 4.2.2, I have a Select List page item (P4_SPONSOR) set to allow multiple values which has a dynamic LOV to populate the list. What I would like to do is highlight the display values based on another page item's value (P4_DRIVER_ID). When I set the source of P4_SPONSOR to static text, such as a delimited string of 1:2:3:4, any display values where the return values are equal to the static text are highlighted when the page loads.
Problem:
The problem lies in trying to use a query as a source for P4_SPONSOR which is filtered based on the other page item, P4_DRIVER_ID. For instance, my SQL Query (returning colon separated values) returns the same as the static text noted above. In the query's WHERE clause, I specify that the driver's ID is equal to P4_DRIVER_ID:
SELECT sponsor_id
FROM sponsors_drivers_xref
WHERE driver_id = :P4_DRIVER_ID;
This, as I understand it, would necessitate a refresh of P4_SPONSOR whenever the value of P4_DRIVER_ID changes. So, I have a Dynamic Action that does just that. When executed on the page, I can see the P4_SPONSOR multiple select list actually refresh, but none of the display values become highlighted.
Thoughts?
Thanks,
-Seth.Seth,
A dynamic action refresh of your select list will refresh the list of values (this is what you are seeing), it will not refresh the value of the item itself. In fact, it will remove any values that you had already selected. To refresh the value you will need to add additional dynamic actions.
Create another dynamic action with:
Event: After Refresh
Selection Type: Item(s)
Item(s): P4_SPONSOR
If this was a normal select list you could just create a Set Value action and use your query to set the value of the select list. Since this is a multiple select list your will need to get your colon delimited value first and then use some javascript to set the values of your select list.
Create an hidden page item name P4_SPONSOR_TEMP.
Add a true action to your new dynamic action:
Action: Set Value
Set Type: SQL Statement
SQL Statement:
SELECT sponsor_id
FROM sponsors_drivers_xref
WHERE driver_id = :P4_DRIVER_ID;
Page Items to Submit: P4_DRIVER_ID
Selection Type: Item(s)
Item(s): P4_SPONSOR_TEMP
Add another true action to your new dynamic action:
Action: Set Value
Set Type: JavaScript Expression
JavaScript Expression:
$("#P4_SPONSOR_TEMP").val().split(":")
Selection Type: Item(s)
Item(s): P4_SPONSOR
--Jeff -
Multiple select parameter with each selected value covering multiple sub values
Hello, everyone,
In my SSRS report, I need to set a multiple select parameter called Group, with values: group1 group2, etc....
When group1 is selected, it needs to apply to data of certain sub groups: sub-group1, sub-group2;
When group2 is selected, it needs to apply to data of different sub groups: sub-group3, sub-group4 and sub-group5;
when both group1 and group2 are selected, then, it needs to apply to data of sub-group1 to sub-group5.
I know how to do it when only one group is selected: simply use a case statement in the query to select the right sub groups based on the group selected.
But I don't know a good way to do it when multiple groups are selected.
Any help, pointers are much appreciated. Thanks in advance!
RegardsHi QQFA,
If I understand correctly, there are two parameters (Group and Sub_group) in the report. When we select group1 in Group parameter, it will auto select sub-group1, sub-group2 in the Sub_group parameter; when we select group2 in Group parameter, it will auto
select sub-group3, sub-group4 and sub_group5 in the Sub_group parameter; when we select both all, it will auto select all sub_group values. If I have misunderstood, please don't hesitate to let me know.
In this scenario, we can create a temporary table with Group and Sub_group columns, then select Sub_group column values based on the Group field. For more details, please see:
Create a dataset with the query below:
CREATE TABLE #temp([group] nvarchar(50),sub_group nvarchar(50))
INSERT INTO #temp VALUES ('group1','sub-group1'),('group1','sub-group2'),('group2','sub-group3'),('group2','sub-group4'),('group2','sub-group5')
SELECT * FROM #temp
where [group] in (@Group)
Set available values and default values of Sub_group parameter with get values from the sub_group field in the new dataset.
Note that the two parameters are all multiple parameters.
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Maybe you are looking for
-
Calling a char** array_name type of variable in the DLL.
Hi, I have to call an external DLL from LabVIEW but I have the following issue. One one of the other forum posts, this issue, I think, had been addressed, by I guess editing the DLL itself, or maybe I did not understand the solution right. But I do n
-
[Solved] Asus L1366 mobo, cpu fan speed control
Hi, everyone, I finally have this new core i7 system, to replace my old AMD athlonx2. I have one question about the CPU fan speed control. I remember that in my old system, the cpu fan speed control works out of box, no configuration is needed. But
-
Lightning connector for audio out
I have a DJ app on my IPAD Air which uses a split cue audio out lead from the headphone jack in order to cue music separately from the main mix. This works fine but I would prefer to use Airplay wireless to the speakers. If I then connect the headpho
-
How do you export favorites on IE on a PC to a file to a flash drive which can then be imported into Safari on a Macbook Pro (I'm switching from being a PC user to being a mac user)
-
Mission Control vs Spaces. Was this an upgrade?
In spaces, I could see which space that I was in by looking at menu bar. Apparently this does not happen with Mission Control. I work most of the time with two monitors and with spaces I could move any window to the space on either monitor. With M