Dynamic lists of values - 2 different SQL query
HelloI use dynamic values lists as mentioned below. This will return 2 different results depending on the conditions.
This does not work, when I run the page, it gives a blank page to Popup when I click on the shortcut menu, it gives me error... * HTP 404 error *... web page not found
P1_ITEM1 elements is of type - Popup LOV key (description of the poster, returns the key value)
if :P1_ITEM1 = 'ABC' then
return 'select ename d, empno r from emp';
else
return 'select dname d, deptno r from dept';
end if;
No idea why it does not workThank you
Deepak
Published by: Deepak_J on January 27, 2010 19:31
Published by: Deepak_J on January 27, 2010 19:32
Published by: Deepak_J on January 27, 2010 19:32
Hello
I don't know why it does not work.
But you can use this query LOV solution in this case
SELECT ename d,
empno r
FROM emp
WHERE :P1_ITEM1 = 'ABC'
UNION
SELECT dname d,
deptno r
FROM dept
WHERE :P1_ITEM1 <> 'ABC' OR :P1_ITEM1 IS NULL
BR, Jari
Tags: Database
Similar Questions
-
Join the query in a dynamic list of values query
I have a join query in a dynamic list of values query. The value does not return a value of text, but rather the value of the ID.
Is it possible to use a join query in a dynamic list of values query?
For example... in the query below, I expect to see ename in the drop-down list, but I see class_emp_id.
Select b.ename d, a.class_emp_id r
of class_emp a, b of the emp
where a.class_cat_id =: CURR_CLASS_CAT_ID
and a.emp_id = b.emp_id
order by 1
Thank you
ReidHey Reid,
The structure of the pairings/value of the item is incorrect - it should be: item1, item2, etc.: value1, value2, etc, so:
' f ? p = & APP_ID.: 50: & SESSION. ": P50_LP_ID, P50_LP_NAME, CURR_CLASS_CAT_ID: #LP_ID #, #LP_NAME #, #CLASS_CAT_ID #"
I guess that CURR_CLASS_CAT_ID does not use the prefix P50_?
Andy
-
creating a dynamic list of values
Hello
While I am trying to create a dynamic list of values on a table (table1) with h_id columns, the head_foot and the header. I gave the query to create the dynamic values as list
Select d, r header header
of g.fw_header_footer
order by 1
where d is the display value and r is the return value to get the error message
"1 error has occurred."
LOV query is not valid, a display and a return value is needed, the column names must be different. If your query contains a query online, the first CLAUSE in the SQL statement must not belong to the query online. »
Can someone please suggest me if am wrong.
Thanks in advanceHello
I suggest that you check the permissions of your application of the analysis of schema has on your g.fw_header_footer table.
It is a mistake to mislead, but I've just reproduced the same problem trying to select from a table that I didn't have SELECT permission.
Scott
-
Passing the value of the SQL query select list
Hello
In my application users have in their homepage to a region which has two simple things, a part of LIST SLECT lov function and a BUTTON
There is also another page which has a normal life to report which shows the employees.
Homepage the user can select certain number of Department in its 'SLECT-LIST' and click 'open '.
For example: If the user has selected a DEP_NUM_5 and click on the BUTTON it will be redirected to the page of a report and gets only showed the employees belonging to the Department 5.
The report page contains a simple SQL query, and I understand that somehow I must pass the value in the SELECT LIST, where I now have the '?
How can I do this, where should I start?
Of course I would really appreciate an example of code, if anyone has time to do a.
select "EMP_ID", "EMP_FORNAME", "EMP_SURNAME", "DEP_NUMBER" from EMP E where E.DEP_NUMBER = ????????
Hi Sozua,
1. create an item hidden on the page where you have the report.
I say P2_DEPT_NO
2 assign to that in your sql query
select "EMP_ID", "EMP_FORNAME", "EMP_SURNAME", "DEP_NUMBER" from EMP E where E.DEP_NUMBER = :P2_DEPT_NO
below the area source ther is also an option
Elements of page to submit-> put this element in this.
for example;
Page to submit items: P2_DEPT_NO
3. change your button
Action: Redirecting to page of this application
Page: 2 / / assuming that page 2 is the report page
Place these items: P2_DEPT_NO
with these values: & P1_SELECT_LIST. assuming that selection list is on page 1
Hope this helps you,
Kind regards
Jitendra
-
Conditional display of interactive report based on the different SQL query
Hello
I have two drop-down list at the top of my page and below I have an interactive report.
Based on the selection of the user from the drop-down list values, interactive report should change based on different SQL queries.
Is it possible to have different SQL queries based on the drop-down list values and generate interactive report based on that?
Thank youHello
You can't have IR based on function returning the query as you can have classic report
But here is a workaround
http://www.oracleapplicationexpress.com/tutorials/71Kind regards
Jari -
Hello
I need to create dynamic lov which must concatenate column name as first name and last name, but I am getting following error
Select first_name. ' '|| last_name, 'name '.
of oehr_Employees
where name =: P8_FIRST_NAME
order by 1
error:
LOV query is not valid, a display and a return value is needed, the column names must be different. If your query contains a query online, the first CLAUSE in the SQL statement must not belong to the query online.
can you please help me?Try
Select first_name. ' '|| display of last_name, first_name. ' '|| last_name return
of oehr_Employees
where name =: P8_FIRST_NAME
order by 1 -
Referring to element values in a sql query
Hello
I used the following query for p3_month item popup LOV
Select month m1, m2 of months of staffing s where s.consultant_name =: p3_consultant_name
But during the race, it appears no values for LOV.
But using as "select month m1, m2 of months of staffing s where s.consultant_name ='Rohit Gupta" "" showing the values for the column for the month.
What is the problem?
Thank you
KouadioHi Steve,.
You can create a process of pl/sql in the Page of the process and give the name of the button in your attribute (tab) of the State of the procedure that you created.
Hope it will work for your condition.
Kind regards
Santini.Published by: Sarah on August 10, 2010 22:49
-
Need to write a different SQL query
Oracle version: 11.2.0.4
create visitors from the table (name varchar2 (10), dated $vdate);
Insert values ('John', sysdate-3) visitors;
Insert values ('John', sysdate-2) visitors;
Insert values visitors ('John', sysdate + 1);
Insert values visitors ('Thomas', sysdate-5);
Insert values visitors ('Thomas', sysdate-4);
Insert values visitors ('Thomas', sysdate + 2);
Insert values visitors ('Adam', sysdate + 1);
Now I need to find the max for each visitor with the name $vdate. I wrote the query below and I'm
My expected results.My query:
Select * from (name, $vdate, dense_rank (select) on mxdate (partition by name $vdate desc order)
visitors)
where mxdate = 1;Output:
NAME $VDATE
John May 14, 2015
Thomas may 15, 2015
Adam, 14 may 2015Can someone write this query using the EXISTS or NOT EXISTS with below terms?
1. without using the aggrgeate function
2. without using the analytic functionThanks for your help in advance...
Note: This is not the original data. This is only the test data...
Something like
Select * from v1 visitors
where does not exist (select 1 of visitors v2 where v1.name = v2.name and v1.vdate<>
NOT TESTED.
-
Cascading list of values &; query
Hi all! ADF BC JDev 11
I use Cascading list of values in the search query pane. I build CLOV as in this example http://www.oracle.com/technology/obe/obe11jdev/11/adfbc_new_features/adfbc.html.
But when I use it in the search query pane it does not work. :(((
I thik I need to put partial triger field details LOV. How can I do?
Help!
Published by: Victor_V_S on 23.11.2009 07:45Autosubmit property of first LOV attribute set to true in the panel display object of advice.
or in the second set LOV attribute depending on the LOV first attribute in the attribute view object dependencies tab
[http://blogs.oracle.com/smuenchadf/2009/11/cascading_lovs_ensuring_the_ma.html]
-
Create a list of values (Lov) programmatically
I need to dynamically create the ListOfValues during execution.
For this, I found a few links, in which it is explained how to create the ViewAccesor and the ListBindingDef which defined the Lov in the model project.
Andrejus Baranovskis Blog: The ADF for BC and dynamic ADF ADF UI generator
Binary: Activation for dynamic attributes ViewObject LOVs
This kind of list of values can be rendered with the component, af:dynamicComponent, but I want to use them with the original component.
The main problem is that: a dynamic list of values attributes do not have listOfValuesModel in the exposed binding.
<af:inputListOfValues id="comunidadAutonomaId" popupTitle="Search and Select: #{bindings.ComunidadAutonoma.hints.label}" value="#{bindings.ComunidadAutonoma.inputValue}" label="#{bindings.ComunidadAutonoma.hints.label}" model="#{bindings.ComunidadAutonoma.listOfValuesModel}" required="#{bindings.ComunidadAutonoma.hints.mandatory}" columns="#{bindings.ComunidadAutonoma.hints.displayWidth}" shortDesc="#{bindings.ComunidadAutonoma.hints.tooltip}"> <f:validator binding="#{bindings.ComunidadAutonoma.validator}"/> </af:inputListOfValues>
Model = "#{Bindings.ComunidadAutonoma.listOfValuesModel}"-> This property is empty in an attribute with a dynamic lov, at the same time, it exists in a standard attribute with lovs. "
I could check bindings exposed during this attributes are different too.
<attributeValues IterBinding="ProvinciasIterator" id="ComunidadAutonoma"> <AttrNames> <Item Value="ComunidadAutonoma"/> </AttrNames> </attributeValues> <listOfValues IterBinding="ProvinciasIterator" StaticList="false" Uses="LOV_Nombre" id="Nombre"/>
To solve it, I thought that I could create the ListOfValuesModel of the ListBindingDef and the ViewAccesor dynamically exposed in a managed Bean, but I don't know how he.
public class MyBean { public MyBean() { initListOfValuesModel(); } private ListOfValuesModel listOfValuesModel; public ListOfValuesModel getListOfValuesModel() { return listOfValuesModel; } private void initListOfValuesModel() { DCBindingContainer bindings = getBindings(); JUCtrlValueBinding attrBinding = (JUCtrlValueBinding)bindings.get("myAttrib"); ViewAttributeDefImpl attr = (ViewAttributeDefImpl) attrBinding.getAttributeDef(); ViewDefImpl viewDef = attr.getViewDef(); ArrayList<ListBindingDef> listBindings = viewDef.getListBindingDefs(); ListBindingDef lbLov = null; for (ListBindingDef listBinding : listBindings) { if (listBinding.getListVOName().equals(attr.getLOVName())) { lbLov = listBinding; break; } } ... //listOfValuesModel = ; }
Another solution would be resolved in the code of the ad: dynamicComponent, because it could render the ListOfValues I programmatically add.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code for adding programmatically to a lov
private void buildLovVO(String voName, String voPath, String sql, Set<DataBindVar> bindVars, List<String> labels) { ViewDefImpl lovDef = new ViewDefImpl(voPath); lovDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME); lovDef.setQuery(sql); lovDef.resolveDefObject(); lovDef.registerDefObject(); if (bindVars != null && bindVars.size() > 0) { VariableValueManager vvm = lovDef.ensureVariableManager(); for (DataBindVar bindVar : bindVars) { VariableImpl lovBindVar = (VariableImpl)vvm.addVariable(bindVar.getBindVarName()); lovBindVar.setJavaType(bindVar.getBindVarType()); lovBindVar.setVariableKind(VariableImpl.VAR_KIND_WHERE_CLAUSE_PARAM); lovBindVar.setProperty(AttributeHints.ATTRIBUTE_DISPLAY_HINT, AttributeHints.ATTRIBUTE_DISPLAY_HINT_HIDE); } } if (labels != null && labels.size() > 0) { ViewObjectImpl lovVO = (ViewObjectImpl)app.createViewObject(voName, lovDef); for (int i = 0; i < labels.size(); i++) { ((AttributeDefImpl)lovVO.getAttributeDefs()[i]).setProperty(AttributeHints.ATTRIBUTE_LABEL, labels.get(i)); } } } private void buildListDef(ViewDefImpl dViewDefImpl, String viewAccessorName, String lovName, String listDataSourceViewDefName, Set<DataBindVar> bindVars, List<String> attribNames, List<String> listAttribNames, List<String> listDisplayAttribNames) { ViewAccessorDef vdef = new ViewAccessorDef(); vdef.setName(viewAccessorName); vdef.setViewDefFullName(listDataSourceViewDefName); vdef.setRowLevelBinds(true); if (bindVars != null && bindVars.size() > 0) { for (DataBindVar bindVar : bindVars) { vdef.getBoundParameters().addBoundParameter(bindVar.getBindVarName(), bindVar.getBindVarValue()); } } dViewDefImpl.addViewAccessorDef(vdef); //---------PREPARAR STRING ARRAYS PARA LA FUNCION buildListBindingDef ------------// String[] strAttribNames = attribNames.toArray(new String[attribNames.size()]); String[] strListAttribNames = listAttribNames.toArray(new String[listAttribNames.size()]); String[] strListDisplayAttribNames = listDisplayAttribNames.toArray(new String[listDisplayAttribNames.size()]); ListBindingDef listBindingDef = buildListBindingDef(dViewDefImpl.getDefManager(), viewAccessorName, lovName, strAttribNames, strListAttribNames, strListDisplayAttribNames); dViewDefImpl.addListBindingDef(listBindingDef); } private static ListBindingDef buildListBindingDef(DefinitionManager defMgr, String listVOName, String listBindingName, String[] attribNames, String[] listAttribNames, String[] listDisplayAttribNames) { ListBindingDef lstbindingDef = new ListBindingDef(defMgr, DefinitionObject.DEF_SCOPE_PERS); lstbindingDef.setListVOName(listVOName); lstbindingDef.setName(listBindingName); lstbindingDef.setListRangeSize(-1); lstbindingDef.setNullValueFlag(AbstractListBinding.LIST_ADD_NULL_NOWHERE); lstbindingDef.setNullValueId(""); lstbindingDef.setAttrNames(attribNames); lstbindingDef.setListDisplayAttrNames(listDisplayAttribNames); lstbindingDef.setListAttrNames(listAttribNames); return lstbindingDef; }
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
JDeveloper 12 c (12.1.2.0.0)
You can download code for ADF Rich Client Demo application (ADF Faces Rich Client Demos ) and see what the code is behind the af:inputListOfValues example (LOV in this example is populated by managed bean).
If you need create liaison for lov programmatically, and then read this blog post: ADF practice: dynamic linking LOV
Dario
-
How to create parameters and the list of values in BI Publisher
Hello friends,
I use BI Publisher 10.1.3. I tried to create a report based on the data of a column for ex: dept_no
in the data model, I specified the name of the table to select all columns
I created the list of values taken as a query sql-type. in the query I wrote dept_no Department selection
In the settings section I gave him as an integer value, and by default as * parameter type in the menu then I chose the name list the value that I've previously specified...
now the problem is when I run the report I receive all data despite selecting the parameter I need particular data of this deptno
What could be the reason
pls let me know
Thanks and greetingsIn your main data model query, you use this parameter to limit the data for the selected service?
For example. Select dept_name of departments where dept_no =: p_dept
where: p_dept is your parameter...
Thank you!
-
How to add 'show all' to a list of values
I have a page element (P10_AIRCARRIER), which is a list of selection - and the list of values is a standard query:
Select faa_name display_value, faa_code return_value
table
The report based on the selected in the select list, faa_name is filled.
It works fine, however the client would like to add 'Show all' to the list of values in the select list, so that if this field is selected, the region of report presents data for all air carriers instead of one.
Can you please indicate how I would do that, as Im not able to add the value "show all" at the table.
Im running 4 Apex.
Thank you
LauraChange the query to:
select faa_name display_value, faa_code return_value from table union all select '- Select All -', null from dual order by 1
Assuming that faa_name values sort after "- select -", it will be the first entry in the list. (Changes should be fairly obvious to other requirements...)
In the report query, the following expression correspond to a certain faa_code, or if "- select all -" is selected:
... faa_code_column = coalesce(:p10_aircarrier, faa_code_column) ...
(Use to_number(:p10_aircarrier) if the faa_code_column type is NUMBER.)
-
I created a page in a table with 3 elements. I wanted one of the items in a value list.
Under the shared components, I created a dynamic list of value. I wanted now to fix the LOV on this element. For the page in question, I went to Page rendering-> items, but can not see all items created for this slot table form. Where did I select the item so that I can join the list of values.
I read the day 2 + Application Express Developer's Guide and followed the example here.
Thank youHello
On your page go to 'regions' and before the name you have given to this area, you can see a link that says "Report" click there and you can see all the items in the form of tables.
-
Dynamic SQL query to get the unique value of list in a column
I have two tables: tblWorkers and tblSkills. tblWorkers has a column, skills, which is populated by a field of multiple-checkbox with one or more skill_IDs of tblSkills, so each tblWorkers.Skills consists of a list of one or more comma-delimited values. For any Skill_ID, I need to generate a list of all workers with the appropriate skills, so I tried to do something in the direction of SELECT WorkerName FROM tblWorkers WHERE IN of skills (skills, #FORM. Skill_ID #)... or WHERE skills (ListFind (skills, #FORM. Skill_ID #))... etc.? My results (once I have had data type mismatches of the road) return all workers, not just those with the desired skills. There must be an easy way to do... How people with a little more experience CF/SQL I do this?> each tblWorkers.Skills consists of a list of one or more comma-delimited values
This is your problem. You store a list of values that you want to access power/query separately in a single column. You will have to burst in a separate table.
TblWorkersTblSkills
TblWorkerSkills
mapping table of many workers with skills.If you do not change your data model now, you will constantly be butting your head against that.
-
SQL query: How to list the values in the IN operator
Hello
I'm going through a list of values to the location of < > in < list >
I don't want to use dynamic cursors (REF CURSOR). Is this possible using Oracle SQL?
Please let me know.
My program:
DECLARE
...
list_of_ids: = '10, 20, 30';
...
SELECT MAX (sal) IN the max_sal FROM Employees WHERE emp_id IN (list_of_ids);
...
END;
/
Thanks in advance,
NikoYou do not want a list separated by commas. You want to move a collection. Then
CREATE TYPE num_tbl AS TABLE OF NUMBER; DECLARE l_list_of_ids num_tbl := num_tbl( 10, 20, 30 ); BEGIN ... SELECT max(sal) INTO max_sal FROM employee WHERE emp_id IN (SELECT * FROM TABLE( l_list_of_ids )); ... END; /
Justin
Maybe you are looking for
-
iCloud Mail on iPhone - what does add boxes to Do letters?
In the mail of iOS, there is a button 'Add the mailbox' when you change the view of the mailbox the stems of the mailbox on the top of the folder list. Anyone know what this does? Did the push of folders under the phone rather than just the Inbox, or
-
Last updated ioS 9.3.2 broke my mail ap. How can I fix?
I installed the latest ioS 9.3.2 update and now my mail that ap will not work. It opens and stops immediately. How can I solve this problem?
-
How to completely remove the Messenger app?
Hello. Anyone know how I can remove the Facebook Messenger of the Cloud application? I want to remove it completely from all my devices and then reinstall it from scratch, but it still shows as yet on the cloud. I'm not sure it relevant to this quest
-
Try to reactivate the taskbar and window transparency
Hello, I am running Windows 7 Home Premium on a new laptop Asus UL50A series. This morning I received a message from Microsoft Update 'important' and so I updated my laptop, rebooted and noticed that the borders of my taskbar and window were more tra
-
Malwarebytes is not automatically updated
I have a full version of the program. It's in my startup. I got him to do a daily scan and it works well. However, he NEVER - refreshes the program or the database Version. I need to "update manually" in order to get the latest data. I put in "Downlo