Three multiselect lists using AJAX
I have an application with 3 multiselect (ms) lists. Selecting one or many items from the first ms list should create a 2nd list of values based on the selection(s) in the 1st ms list. A 3rd ms list should then be created based on the selection(s) from the 2nd ms list. The selection(s) in the 3rd ms list are then used to create a report based on those selections.
I'd like to be able to do this using AJAX. I've created an AJAX process to do this using single selections but not multiple selections (following Carl Backstrom's examples).
Any help would be appreciated.
Thanks,
John
Hi,
I also played a little bit around, having a multi select list as master.
The outcome was that the framework didn't support it, because
-) the value attribute of a multi-select-list just returns the first selected entry
-) APEX is having a problem if a colon is contained in an AJAX request
But the good news is that after some corrections the framework is now able to support multi-select-lists as a master of a cascading lov! :-)
Write me an e-mail to get the newest files for the framework.
Patrick
Check out my APEX-blog: http://inside-apex.blogspot.com
Check out the ApexLib Framework: http://apexlib.sourceforge.net
Similar Messages
-
Create a select list using AJAX
Hello,
I saw Carl Backstrom and Scott Spendolini examples on how to use AJAX to populate a related item, based on a select list. What I'm looking for is the reversed angle.
I have a TextItem, and I want to generate a select list based on that TextItem, something like this:
select code, desc
from Table
where code like TextItem
Is it possible with AJAX? (in the current examples I gat lost in the on demand application process How, if possible, to render the select list using the HTP package.)
Greatly appreciate the help
Arie.Carl,
I hope you can help with this, from reading the forum, you seem to have a lot of experience with AJAX and Application Express. I have found your examples within the forums and can not get them to work on my servers. I am on version 2, and a 10g database. I am attempting to place 4 select lists on a page. Each one (with exception from the first) will be dependent on the previous. To make is simple I have started with only 2 select lists. The first select list (p1_select1) is a list of departments. The second list (p1_select2) should populate with the users who belong to the department selected from p1_select1. I can not seem to get the second select list to load. I have attempted to follow your code as best I could, I can see on the page that it has created the xml data, however it just does not populate the second select list. Here is a summary of what I have.
Thanks for lookin.
Mike
Page Regions:
HTML: main (10)
Region Header:
<script language="JavaScript1.1" type="text/javascript">
function f_Get_Data(pThis,pSelect_Source,pSelect_Target){
var l_Return = null;
var l_Select = html_GetElement(pSelect_Target);
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=Get_Data',0);
get.add(pSelect_Source,pThis.value);
gReturn = get.get('XML');
if(gReturn && l_Select){
var l_Count = gReturn.getElementsByTagName("option").length;
l_Select.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("option");
appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
get = null;
function appendToSelect(pSelect, pValue, pContent) {
var l_Opt = document.createElement("option");
l_Opt.value = pValue;
if(document.all){/* why is ie different ask bill */
pSelect.options.add(l_Opt);
l_Opt.innerText = pContent;
}else{
l_Opt.appendChild(document.createTextNode(pContent));
pSelect.appendChild(l_Opt);
</script>
Items
Region: main
10: P1_TEXT1 Select List
20: P1_TEXT2 Select List
P1_TEXT1 Form Element:
onChange="javascript:f_Get_Data(this,'P1_TEXT1','P2_TEXT2')";
APPLICATION PROCESS "On Demand" Get_Data:
declare
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
htp.prn('<select>');
for rec in (select ENAME , EMPNO
from EMP where DEPTNO = :P1_text1) loop
htp.prn('<option value="' || rec.EMPNO || '">' || rec.ENAME || '</option>');
end loop;
htp.prn('</select>');
exception
when no_data_Found then
null;
end; -
Need Help on Select list using AJAX
Hi ,
I have a 3 select list in the application,
2nd select list depends on 1st, 3rd depends on 1st and 2nd.
I have created application items and process and java script, but for some reason i can not pass 2 application items values to the process.
Please any idea or example. I have followed dennis site for creating cascade select demo application.
Thanks
KPDid you have a look at this thread:
Problem with Dynamic Select Lists
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Ajax - Populate Multiselect List
I have a requirement to populate a multiselect list using Ajax. Does anyone of you know
how to acomplish that?
I would klick on rows in a report and pick the values from there and the values would be
concatenated to the existing content of a multiselect list item.
Denes KubicekHi Denes,
have a look at the code of the "List Manager" item type. I think that's exactly what you are looking for.
Patrick
Check out my APEX-blog: http://inside-apex.blogspot.com
Check out the ApexLib Framework: http://apexlib.sourceforge.net -
How do you do anchors - the three ways listed did not work. I am using the jQuery mobile template 11. I want to link to a spot on the same page.
How do you do anchors - the three ways listed did not work. I am using the jQuery mobile template 11.
You have aroused my curiousity, what are three ways listed that do not work? At risk of being labeled as an ignoramus, could you also tell me where to get the other 10 templates?
I usually give an element an ID and use that in my link as in
<a href="#mySpot">Go to my spot</a>
<div id="mySpot">
</div> -
How to get multiselect list values
I have a multiselect list set up called :P_Staff_ID which uses a LOV (select staff_name, staff_id from staff)
to display staff names to the screen.
What function can i use to get all the selected names in the list for my submit process?
Thanks
RayRay,
The selected values will be returned as a colon delimited list, e.g.: 20:30:40:50
You can use the htmldb_util.string_to_table function to convert it to something a more suitable for inserting. This is the spec of the function from the documentation:
HTMLDB_UTIL.STRING_TO_TABLE (
p_string IN VARCHAR2,
p_separator IN VARCHAR2 DEFAULT ':')
RETURN HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
and a sample that loops over the values:
DECLARE
l_vc_arr2 HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
BEGIN
l_vc_arr2 := HTMLDB_UTIL.STRING_TO_TABLE('One:Two:Three');
FOR z IN 1..l_vc_arr2.count LOOP
htp.p(l_vc_arr2(z));
END LOOP;
END;
Sergio -
How to use Ajax Get Multiple Values in Tabular form?
Hi All-
I am trying to use AJAX to get multiple values in tabular form by using Denes Kubicek's example in the following link -
http://apex.oracle.com/pls/otn/f?p=31517:239:9172467565606::NO:::
Basically, I want to use the drop down list to populate rest of the values on the form.
I have created the example(Ajax Get Multiple Values, application 54522) on Oracle site -
http://apex.oracle.com/pls/apex/f?p=4550:1:0:::::
Workspace: iConnect
login: demo
password: demo
I was able to duplicate his example on page 1 (home page).
However, I want to use system generate tabular form to finish this example, and was not able to populate the data correctly.
Page 2 (method 2) is the one that I am having trouble to populate the column values. When I checked application item values in Session, and the values seems to be populated correctly.
This is what I have done on this page:
1. Create an Application Process On Demand - Set_Multi_Items_Tabular2:
DECLARE
v_subject my_book_store.subject%TYPE;
v_price my_book_store.price%TYPE;
v_author my_book_store.author%TYPE;
v_qty NUMBER;
CURSOR cur_c
IS
SELECT subject, price, author, 1 qty
FROM my_book_store
WHERE book_id = :temporary_application_item2;
BEGIN
FOR c IN cur_c
LOOP
v_subject := c.subject;
v_price := c.price;
v_author := c.author;
v_qty := c.qty;
END LOOP;
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<body>');
HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
HTP.prn ('<item id="f04_' || :t_rownum || '">' || v_subject || '</item>');
HTP.prn ('<item id="f05_' || :t_rownum || '">' || v_price || '</item>');
HTP.prn ('<item id="f06_' || :t_rownum || '">' || v_author || '</item>');
HTP.prn ('<item id="f07_' || :t_rownum || '">' || v_qty || '</item>');
HTP.prn ('</body>');
END;
2. Create two application items - TEMPORARY_APPLICATION_ITEM2, T_ROWNUM2
3. Put the following in the Page Header:
<script language="JavaScript" type="text/javascript">
function f_set_multi_items_tabular2(pValue, pRow){
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=Set_Multi_Items_Tabular2',0);
if(pValue){
get.add('TEMPORARY_APPLICATION_ITEM2',pValue)
get.add('T_ROWNUM2',pRow)
}else{
get.add('TEMPORARY_APPLICATION_ITEM2','null')
gReturn = get.get('XML');
if(gReturn){
var l_Count = gReturn.getElementsByTagName("item").length;
for(var i = 0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
var l_ID = l_Opt_Xml.getAttribute('id');
var l_El = html_GetElement(l_ID);
if(l_Opt_Xml.firstChild){
var l_Value = l_Opt_Xml.firstChild.nodeValue;
}else{
var l_Value = '';
if(l_El){
if(l_El.tagName == 'INPUT'){
l_El.value = l_Value;
}else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
l_El.parentNode.innerHTML = l_Value;
l_El.parentNode.id = l_ID;
}else{
l_El.innerHTML = l_Value;
get = null;
</script>
Add the follwing to the end of the above JavaScript:
<script language="JavaScript" type="text/javascript">
function setLOV(filter, list2)
var s = filter.id;
var item = s.substring(3,8);
var field2 = list2 + item;
f_set_multi_items_tabular2(filter, field2);
4. Tabular form query:
select
"BOOK_ID",
"BOOK",
"SUBJECT",
"PRICE",
"AUTHOR",
"QTY",
"BOOK_ID" BOOK_ID_DISPLAY
from "#OWNER#"."MY_BOOK_STORE"
5. In Book_ID_DISPLAY column attribute:
Add the following code to element attributes: onchange="javascript:f_set_multi_items_tabular2(this.value,'#ROWNUM#');"
Changed to -> onchange="javascript:setLOV(this,'f03');"
Now, T_ROWNUM2 returns value as f03_0001. But, TEMPORARY_APPLICATION_ITEM2 returns as [object HTMLSelectElement]...
Please help me to see how I can populate the data with this tabular form format. Thanks a lot in advanced!!!
Ling
Updated code in Red..Ling
Lets start with looking at what the javascript code is doing.
function f_set_multi_items_tabular(pValue, pRow){
/*This will initiate the url for the demand process to run*/
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
if(pValue){
/*If there is an value than submit item name with value*/
get.add('TEMPORARY_APPLICATION_ITEM',pValue)
get.add('T_ROWNUM',pRow)
}else{
/*Else set the item TEMPORARY_APPLICATION_ITEM to null*/
get.add('TEMPORARY_APPLICATION_ITEM','null')
/*Submit the url and te returned document is of type XML*/
gReturn = get.get('XML');
if(gReturn){
/*There is something returned*/
var l_Count = gReturn.getElementsByTagName("item").length;
/*For all elements of the tag item*/
for(var i = 0;i<l_Count;i++){
/*Get the item out of the XML*/
var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
/*Get the id of the item*/
var l_ID = l_Opt_Xml.getAttribute('id');
/*Get the element in the original page with the same id as
**the item we have in the XML produced by the ondemand process
var l_El = html_GetElement(l_ID);
/*Now get the value of the item form the XML*/
if(l_Opt_Xml.firstChild){
var l_Value = l_Opt_Xml.firstChild.nodeValue;
}else{
/*There is no value*/
var l_Value = '';
if(l_El){
/*There is an element with the same id as the item we are processing*/
if(l_El.tagName == 'INPUT'){
/*The element is an input item just set the value*/
l_El.value = l_Value;
}else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
/*If it is a span elment and has the class grabber
**Then set the innerHTML of the parent to the value
**and the id of the parent to the id
l_El.parentNode.innerHTML = l_Value;
l_El.parentNode.id = l_ID;
}else{
/*Else set the value as innerHTML*/
l_El.innerHTML = l_Value;
get = null;
Now where it went wrong in your initial post
The XML that was returned by your XML process would be something like
<body>
<desc>this xml genericly sets multiple items</desc>
<item id="f02_1">CSS Mastery</item>
<item id="f03_1">22</item>
<item id="f04_1">Andy Budd</item>
<item id="f05_1">1</item>
</body>
When you don't use apex_item to create your tabular form a item in the table will look like
<input id="f02_0001" type="text" value="CSS Mastery" maxlength="2000" size="16" name="f05" autocomplete="off">
Notice the id's f02_1 and f02_0001 don't match.
So to make it work the XML would have to look like
<body>
<desc>this xml genericly sets multiple items</desc>
<item id="f02_0001">CSS Mastery</item>
<item id="f03_0001">22</item>
<item id="f04_0001">Andy Budd</item>
<item id="f05_0001">1</item>
</body>
To do that simply use lpad in the ondemand process like
HTP.prn ('<item id="f02_' || lpad(:t_rownum,4,'0') || '">' || v_subject || '</item>');
HTP.prn ('<item id="f03_' || lpad(:t_rownum,4,'0') || '">' || v_price || '</item>');
HTP.prn ('<item id="f04_' || lpad(:t_rownum,4,'0') || '">' || v_author || '</item>');
HTP.prn ('<item id="f05_' || lpad(:t_rownum,4,'0') || '">' || v_qty || '</item>');
Keep in mind that the above is based on your original post and #ROWNUM# not being lpadded with zero's.
Nicolette -
How to get the selected values from multiselected list
Hi,
I have a multiselect list displaying all the years from 2003 to 2008 (used dynamic LOV). The user can choose one or more years as per his needs, and then when user clicks on the link the selected values of the list are to be captured and a pop up page of a Discoveror report needs to be opened where these years get passed as a parameter. I tried several methods to capture the value, but either one or all are getting passed but not exactly what the user has chosen.
This is how it looks:
P2_FISCAL_YEAR is a multiselect list containing values from 2003,2004... 2008
If user chooses 2004 and 2007
then I want the url to capture these values and pass as parameters for my discoveror reports. as '&qp_fiscal_year=2004,2007'
Any help is appreciated!
Thanks in advance,
Sapna.Hi,
I have a multiselect list displaying all the years from 2003 to 2008 (used dynamic LOV). The user can choose one or more years as per his needs, and then when user clicks on the link the selected values of the list are to be captured and a pop up page of a Discoveror report needs to be opened where these years get passed as a parameter. I tried several methods to capture the value, but either one or all are getting passed but not exactly what the user has chosen.
This is how it looks:
P2_FISCAL_YEAR is a multiselect list containing values from 2003,2004... 2008
If user chooses 2004 and 2007
then I want the url to capture these values and pass as parameters for my discoveror reports. as '&qp_fiscal_year=2004,2007'
Any help is appreciated!
Thanks in advance,
Sapna. -
Multiselect list in APEX 3.2.1.00.12
Hello,
I'm having troubles with a multiselect list that could potentially return a very large result set. I have a function called 'GET_LIST' that basically calls the apex_util.STRING_TO_TABLE(p_string,p_delimiter); function since the multiselect list returns a colon delimited string. If I try to select all of the values on the list I get the following message:
Bad Request
The request could not be understood by server due to malformed syntax.Are there any known workarounds to this issue?
Thanks in advance!
~JakeDo any pros out there have a suggestion for this? My multiselect list has over 35,000 entries in it for certain owners. It is doubtful that anyone would ever select them all but if they should happen to they would receive an error.
The list of values (P10_ACCTS) is simply
select a.account_name d, a.account_id v
from accounts a
where a.owner = :P10_OWNERI then display a report that uses the results of the select list in the where clause:
and (account.id in (select column_value from table (GET_LIST(nvl(:P10_ACCTS,'::'))))GET_LIST is defined as:
CREATE OR REPLACE FUNCTION GET_LIST (
p_string IN VARCHAR2,
p_delimiter IN VARCHAR2 DEFAULT ':'
RETURN vc_array_1 PIPELINED
IS
l_string varchar2(32000);
l_array wwv_flow_global.vc_arr2;
BEGIN
l_array := apex_util.STRING_TO_TABLE(p_string,p_delimiter);
for i in l_array.first..l_array.last loop
pipe row (trim(l_array(i)));
end loop;
return;
end;I believe that my limitation is the 'l_string varchar2(32000);' I need (in some cases) to be able to pass over 100,000 characters. I've tried converting GET_LIST to use a clob instead of varchar2 but have yet to be successful in implementing that approach.
THanks in advance!
Edited by: jhammer on Oct 15, 2010 3:13 PM -
HOW CAN WE ASSIGN THREE TASK LIST TO THREE DIFF PRODUCTION ORDER
Respected All
we have one material which is used for three places FIRST IN MILL1, 2ND IN MILL2 AND THIRD IN TRIMMER MILL.
the only thing which differentiate this single material is the production order. we have 3 different production order but one single material. for this we have created 3task list. my problem is when we create batch and confirm it through co15, the lot reflects in QA32. but is not allowing for USAGE DECESION. For that we have to go to QA02, assign the task list and then again go to QA32 and do the usage decesion. is there any method by which we can assign three task list to three production orders so that qa02 step could be avoid.
pls reply
thanks
abhaysir
thank you for the reply could you please tell me in which transaction we find this user exit.
thanks
abhay -
How do I query a SharePoint List using a url and filtering on date?
I am reading a SharePoint list using jquery. Everything is working fine
except for the filter. Each list item has an expiration date. I want to retrieve JUST the items that have not expired (Expires > Today) but I can't figure out the url syntax and I've been searching all day for an example and
can't find one. Could someone please help?!? See bold code below.
Thanks,
Glen
$(document).ready(function ()
<strong>var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
</strong> $.getJSON(qryWCFUrl, function (results)
$.each(results.d.results, function (i, mmAlert)
itemID = mmAlert.Id;
mmTitle = mmAlert.Title;
mmClass = mmAlert.ClassValue;
//alert("Item="+itemID+" Title="+mmTitle+" Class="+mmClass);
AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);Fadi,
Thanks for your response. I actually have another version of the code that uses the SP client objects that works. The problem is site boundries. Let me give a more complete project explanation.
I am creating a master page for a new intranet. As part of this master page, I want to read from an SP list of alerts and post each alert (if not expired) in the SP status bar. I've gotten this to work with SP client objects and jquery (except
for the date filter part). Both of these solutions work fine on the top site level. BUT when trying it out at the sub-site level, the SP client objects version of my code fails. The jQuery version works except the date filtering.
I looked at the example from your link and it looks like a bit of a hybrid to my approaches: JQuery with CAML. My question is; does this example permit me to access a list in the top-level site from the subsites? Please excuse my ignorance,
but I am an EXTREME newbie in this having spent the past 8 years as a VB.Net developer and a little bit of ASP.Net.
Below are the two different versions of my code in different versions of my master page definition:
SP Client Object Version
<script type="text/javascript">
// <![CDATA[
ExecuteOrDelayUntilScriptLoaded(LoadAlerts, "sp.js");
var ctx;
var currAlerts;
function LoadAlerts() {
ctx = new SP.ClientContext.get_current();
list = ctx.get_web().get_lists('/sites/MMTP1/Lists/').getByTitle('MMAlerts');
var cmlQry = new SP.CamlQuery();
var camlExp = '<query><Query><Where><Gt><FieldRef Name="Expires" /><Value IncludeTimeValue="FALSE" Type="DateTime"><Today /></Value></Gt></Where></Query></query>';
cmlQry.set_viewXml(camlExp);
currAlerts = list.getItems(cmlQry);
ctx.load(currAlerts,'Include(ID,Title,Class)');
ctx.executeQueryAsync(GetAlertsSuccess,GetAlertsFailed);
function GetAlertsSuccess() {
var lstEnum = currAlerts.getEnumerator();
while(lstEnum.moveNext()) {
var mmAlert = lstEnum.get_current();
AddMMStatus(mmAlert.get_item('ID'),mmAlert.get_item('Title'),mmAlert.get_item('Class'));
function GetAlertsFailed(sender,args) {
alert('Alerts load failed: ' + args.tostring);
function AddMMStatus(msgID, strTitle, strClass) {
var statID;
var statClass;
var statTitle;
statClass = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a>";
statTitle = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a>";
statID = SP.UI.Status.addStatus(statClass, statTitle, true);
SP.UI.Status.setStatusPriColor(statID,"red");
function DisplayAlert(msgID) {
var options = {
title: "Miller & Martin Alert!",
url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
allowMaximize: false,
showClose: true
SP.UI.ModalDialog.showModalDialog(options);
// ]]>
</script>
JQuery Version (works except for filtering by date)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" >
// <![CDATA[
var itemID;
var mmTitle;
var mmClass;
$(document).ready(function ()
var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
$.getJSON(qryWCFUrl, function (results)
$.each(results.d.results, function (i, mmAlert)
itemID = mmAlert.Id;
mmTitle = mmAlert.Title;
mmClass = mmAlert.ClassValue;
AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);
function AddMMStatus(msgID, strTitle, strClass, strSeverity) {
var statID;
var statClass;
var statTitle;
statClass = "<div id=\"mmAlertTitle\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a></div>";
statTitle = "<div id=\"mmAlertDetail\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a></div>";
statID = SP.UI.Status.addStatus(statClass, statTitle, true);
SP.UI.Status.setStatusPriColor(statID,"green");
function DisplayAlert(msgID) {
var options = {
title: "Miller & Martin Alert!",
url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
allowMaximize: false,
showClose: true
SP.UI.ModalDialog.showModalDialog(options);
// ]]>
</script> -
ApEx newbie here,
I'm trying to get the output of a multi select list into an in list of a sql query for a report. The error message I'm getting is report error:
ORA-01722: invalid number. (The inlist is a list of id numbers, and the data type for this column in the database is NUMBER)
I've got a page item called P3_x which is populated from a MultiSelect list. I learned that these come out as colon delimited strings. (found a reference to hidden items in a blog that helped me figure this out)
So I created a hidden item called P3_x_in_list which does this:
Select '('|| regexp(:p3_x,':',',')||')' from dual which turns this into a comma separated list, like so: (1,2,3,4)
I put this hidden item, P3_X_IN_LIST into the sql in my report region
So in the report my sql looks like:
select a, b, c
from t1
where id in: P3_x_in_list
and some_date between :P1_X and :P2_X
For some reason it throws an invalid number error when it runs. I haven't been able to find anything in the documentation or on the web that sheds any light on this. I'm hoping that there is a benevolent, experienced developer that can point me in the right direction. The debuging information from the page is below:
Here is the debugging information
0.24: ...Session State: Save "P3_X" - saving same value: "1:2:3:4:5"
0.24: ...Session State: Save "P1_X" - saving same value: "01-DEC-2008"
0.24: ...Session State: Save "P2_X" - saving same value: "04-DEC-2008"
0.30: ...Session State: Save Item "P3_X_IN_LIST" newValue="(1,2,3,4,5)" "escape_on_input="N"
0.30: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
0.46: show report
0.46: determine column headings
0.46: parse query as: my_schema
1.76: binding: ":P3_X_IN_LIST"="P3_X_IN_LIST" value="(1,2,3,4,5)"
2.64: binding: ":P2_X"="P2_X" value="04-DEC-2008"
report error:
ORA-01722: invalid number
ORA-02063: preceding line from my_schema
3.23: Computation point: AFTER_BOX_BODY
3.23: Processing point: AFTER_BOX_BODY
3.23: Computation point: BEFORE_FOOTER
3.23: Processing point: BEFORE_FOOTER
3.23: Show page tempate footerWell, let's say you had a SQL statement like
select * from obj where object_id in 12345
where object_id is defined to be a number type.
Now, if you replace the literal '12345' with a bind variable and then bind "(1,2,3,4,5)" to this bind variable it will be clear why the SQL fails.
As for using pipeline functions it is pretty straightforwad
Here's an example
CREATE OR REPLACE TYPE vc_array_1 AS TABLE OF VARCHAR2 (50);
CREATE OR REPLACE FUNCTION get_list (
p_string IN VARCHAR2,
p_delimiter IN VARCHAR2 DEFAULT ':'
RETURN vc_array_1 PIPELINED
IS
l_string varchar2(32000);
l_array wwv_flow_global.vc_arr2;
BEGIN
l_array := apex_util.STRING_TO_TABLE(p_string,p_delimiter);
for i in l_array.first..l_array.last loop
pipe row (trim(l_array(i)));
end loop;
return;
end;
select column_value from table (get_list('1:2:3:4:5'));Your query can now be
select a, b, c
from t1
where id in (select column_value from table get_list(: P3_x_in_list)) )
and some_date between :P1_X and :P2_XVarad -
Using AJAX to load city, state, metro area based on zip code
I'm new to getting APEX to work with AJAX properly. I've been reading some tutorials and trying to apply what they do to my situation, but I'm running into a problem. I have a text field item for zip code. What I want to happen is that when someone enters in a zip code, I want to use AJAX to populate 3 different select lists (1 each for state, city, and metro area) and to populate a checkbox (of neighborhoods based on the zip code as well). I'm looking at the examples in:
http://www.oraclealchemist.com/wp-content/uploads/2006/11/s281946.pdf
and
http://apex.oracle.com/pls/otn/f?p=11933:63
But they all use examples where the value of a text field item is used to populate 1 select list. I can't figure out how to apply that methodology to populate 3 select lists and 1 checkbox item. I've got all my SELECT statements written to populate these fields based on the value of the zip code text field item, but don't know how to convert what I already have to use AJAX.
Here are my SELECT statements:
P2805_STATE lov:
===========================================================================================
SELECT INITCAP(GEO_DATA_STATE.STATEFULLNAME) d,GEO_DATA_STATE.STATE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP
WHERE isPrimary = 'P' and
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY STATEFULLNAME
P2805_CITY lov:
===========================================================================================
SELECT UNIQUE (INITCAP(GEO_DATA_CITY.CITY)) d,GEO_DATA_CITY.CITY v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_CITY
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.CITY)) = trim(upper(GEO_DATA_CITY.CITY)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY GEO_DATA_CITY.CITY
P2805_METRO_AREA lov:
===========================================================================================
SELECT UNIQUE (INITCAP(GEO_DATA_METRO.METRO_AREA)) d,GEO_DATA_METRO.CODE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1
P2805_NEIGHBORHOOD lov:
===========================================================================================
SELECT UNIQUE (INITCAP(GEO_DATA_HOOD.HOOD)) d,GEO_DATA_HOOD.HOOD v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO, GEO_DATA_HOOD
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_HOOD.METRO_CODE = GEO_DATA_METRO.CODE and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1Do all these statements need to go in 1 on-demand process? Where do I go from here?Andy, cool. This is starting to make more sense. THANKS A BUNCH! OK. I've gone ahead and modified the on demand process to suit my needs, so I have:
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
-- Building States list
htp.prn('<SELECT>');
FOR i in (
SELECT INITCAP(GEO_DATA_STATE.STATEFULLNAME) d, GEO_DATA_STATE.STATE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP
WHERE isPrimary = 'P' and
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY STATEFULLNAME
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
-- Building Cities list
htp.prn('<SELECT>');
FOR i in (
SELECT UNIQUE (INITCAP(GEO_DATA_CITY.CITY)) d, GEO_DATA_CITY.CITY v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_CITY
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.CITY)) = trim(upper(GEO_DATA_CITY.CITY)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY GEO_DATA_CITY.CITY
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
-- Building Metro Area list
htp.prn('<SELECT>');
FOR i in (
SELECT UNIQUE (INITCAP(GEO_DATA_METRO.METRO_AREA)) d, GEO_DATA_METRO.CODE v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
-- Building Neighborhood list
htp.prn('<SELECT>');
FOR i in (
SELECT UNIQUE (INITCAP(GEO_DATA_HOOD.HOOD)) d, GEO_DATA_HOOD.HOOD v
FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO, GEO_DATA_HOOD
WHERE
trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
GEO_DATA_HOOD.METRO_CODE = GEO_DATA_METRO.CODE and
GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
ORDER BY 1
LOOP
htp.prn('<OPTION VALUE=''' || i.v || '''>' || i.d || '</OPTION>');
END LOOP;
htp.prn('</SELECT>');
end;It doesn't look like I would have to modify the appendToSelect function at all, correct? Is the checkbox that I need to populate handled the same way as these select lists? And it seems like I only need to make the 2 changes that you mentioned to get_AJAX_SELECT_XML function, right? So my javascript function should be like:
<script language="JavaScript1.1" type="text/javascript">
function get_AJAX_SELECT_XML(pThis,pSelect1,pSelect2,pSelect3,pSelect4){
if (document.getElementById('P2805_ZIPCODE').value.length == 5)
var l_Return = null;
var l_Select1 = $x(pSelect1);
var l_Select2 = $x(pSelect2);
var l_Select3 = $x(pSelect3);
var l_Select4 = $x(pSelect4);
var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=otn_Select_XML',0);
get.add('TEMPORARY_ITEM',pThis.value);
gReturn = get.get('XML');
var sels = gReturn.getElementsByTagName("select");
if(gReturn && l_Select1){
var l_Count = sels[0].getElementsByTagName("option").length;
l_Select1.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[0].getElementsByTagName("option");
appendToSelect(l_Select1, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
if(gReturn && l_Select2){
var l_Count = sels[1].getElementsByTagName("option").length;
l_Select2.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[1].getElementsByTagName("option")[i];
appendToSelect(l_Select2, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
if(gReturn && l_Select3){
var l_Count = sels[2].getElementsByTagName("option").length;
l_Select3.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[2].getElementsByTagName("option")[i];
appendToSelect(l_Select3, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
if(gReturn && l_Select4){
var l_Count = sels[3].getElementsByTagName("option").length;
l_Select4.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = sels[3].getElementsByTagName("option")[i];
appendToSelect(l_Select4, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
get = null;
</script>
And then since all 4 items (3 select lists and 1 checkbox item) are populated based on the value inputted in the text field item, I would only need to add the following to the html form element attribute of my text field item, right?
onKeyUp="javascript:get_AJAX_SELECT_XML(this,'P2805_STATE','P2805_CITY','P2805_METRO_AREA','P2805_NEIGHBORHOOD');"Denes, thanks for the example. It seems like what I need to do is somewhere inbetween what you have and what's in the example on http://apex.oracle.com/pls/otn/f?p=11933:37. I have 3 select lists and 1 checkbox item that should all be populate depending on the value entered for the text item. Do I still need to split everything up then into a function and an on demand process for each select list and checkbox? -
Is it possible to create a tree with drag-and-drop functionality using ajax
I saw these samples;
Scott Spendolini's AJAX Select List Demo
http://htmldb.oracle.com/pls/otn/f?p=33867:1:10730556242433798443
Building an Ajax Memory Tree by Scott Spendolini
http://www.oracle.com/technology/pub/articles/spendolini-tree.html
Carl Backstrom ApEx-AJAX & DHTML examples;
http://htmldb.oracle.com/pls/otn/f?p=11933:5:8901671725714285254
Do you think is it possible to create a tree with drag-and-drop functionality using ajax and apex like this sample; http://www.scbr.com/docs/products/dhtmlxTree/
Thank you,
Kind regards.
TonguçHello,
Sure you can build it, I just don't think anyone has, you could also use their solution as well in an APEX page it's just a matter of integration.
Carl -
Need to create an edit Page from a Multiselect List
I make one or more selections of values from a Multiselect List; I need to branch to another page in which I display all of the selected List items and two other columns (per item) that can be edited; i.e., this second page will look like one or more rows consisting of (1) List item, (2) value1 from a Table, (3) value2 from a Table. I need to be able to change value1 and/or value2 for any or all of the rows and have those changes reflected in the Database. (The List item is display only).
My question is: which construction wizard can I use for this second page? I can collect my List items in a PL/SQL Table, but how can I display them and their related columns so the column values are editable?Thanks for the reply. I understand how to create Collections with the values I need to display and modify; however, I'm unsure which construction Wizard to employ to launch the Page ("Form based upon a Procedure", etc.)
I looked in the Tutorials for a "collection demo" and found these potential candidates: "Build an Issue Tracking System", "Create a Simple Survey Application", and "Serving Application Express Reports". Is it one of these? If not, please tell me where I can find the "collection demo". Thanks.
Maybe you are looking for
-
How to deploy par without NWDS wizard
Hello All, How can we deploy PAR files without NWDS wizard. We have developed a functionality packaged in PAR, how we can deploy it on Client Side Portal, do there some way to deploy it without NWDS. Thanks and regards Santosh
-
I'll start out by saying that I've hurled every curse I can imagine out into the inky blackness of space the past four weeks. I've pulled out hair, gnashed teeth, thrown chairs, punched walls, and have almost gone nuclear. I have a laptop. External h
-
Hi all, I need to produce a report that essentially gives me what is produced from MB51 though with document currency as well as local currency. Is there anyway of constructing a report? It's sending me crazy though just not sure how to link the MM r
-
hello we want to do replication of database, but since we are having std edition it seems it may not be possible to go ahead with this idea. snapshot might be one possbile way. i just wanted to know if we are having 500 tables in our database how can
-
Making table cells non-focusable
I have a JTable in which some of the cells should never receive the keyboard focus. I want the TAB key to skip over these non-editable cells, but I'm having trouble. I've tried using a cell renderer where getTableCellRendererComponent calls setFocusa