Ajax code help for conditional select list.
Hi,
I am using AJAX code for the first time, I dont have knowledge in java, I just grabbed the code from this forum and trying to manipulate to my requirement.
My Requirement is I have two select lists, 1) host_name and 2) database_name.
As soon as I pick/choose the value in host_name select list, I need to populate only those databases on that particular host. I dont want to submit the page for this action.
Here is the code, I appreciate if some one can help.
On demand Application Process code:
declare
l_counter number;
l_o_name varchar2(2000);
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 "ORA_DATABASES_VW"."DATABASE_NAME" as "DATABASE_NAME",
"ORA_DATABASES_VW"."DB_ID" as "DB_ID"
from "ORA_DATABASES_VW"
where "ORA_DATABASES_VW"."HOST_NAME" = :TEMP_ITEM)
loop
htp.prn('<option value="' || rec.db_id || '">' || rec.database_name || '</option>');
end loop;
htp.prn('</select>');
end;
HTML Header on that page:
=================
<script language="JavaScript1.1" type="text/javascript">
function get_List_XML (source_item,target_item){
var v_Target = html_GetElement(target_item);
var v_Source = html_GetElement(source_item);
var ajaxResult = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=POPULATE_LIST_XML',0);
ajaxResult.add('TEMP_ITEM',source_item.value);
var v_result_xml = ajaxResult.get('XML');
if(v_result_xml && v_Target)
var options_Contents = v_result_xml.getElementsByTagName("option");
v_Count = options_Contents.length;
v_Target.length = 0;
for(var i=0;i<v_Count;i++)
var v_opt_xml = v_result_xml.getElementsByTagName("option");
appendToSelect(v_Target, v_opt_xml.getAttribute ('value'),v_opt_xml.firstChild.nodeValue)
function appendToSelect(target_item, option_val, option_content) {
var v_Opt = document.createElement("option");
v_Opt.option_value = option_val;
if(document.all){
target_item.options.add(v_Opt);
v_Opt.innerText = option_content;
}else{
v_Opt.appendChild(document.createTextNode(option_content));
target_item.appendChild(v_Opt);
</script>
Form element attribute in the host_name column. P935_INSTANCE_DB_NAME is my page item for database_name.
onchange="get_List_XML (this,'P935_INSTANCE_DB_NAME')"
Here is the code, Hope I had put it correctly now.
This is fixed now. Thanks a lot for helping out this. I have two questions.
1) I am seeing very slowness when selecting the select list. Will these java code require much resource?
2) I need to put this logic in many screens for many columns. So having these many application process and application items and java code, will the application performance get a hit? I know that application process are on-demand and get called only when required.
declare
l_counter number;
l_o_name varchar2(2000);
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 "ORA_DATABASES_VW"."DATABASE_NAME" as "DATABASE_NAME",
"ORA_DATABASES_VW"."DB_ID" as "DB_ID"
from "ORA_DATABASES_VW"
where "ORA_DATABASES_VW"."HOST_NAME" = :TEMP_ITEM)
loop
htp.prn('<option value="' || rec.db_id || '">' || rec.database_name || '</option>');
end loop;
htp.prn('</select>');
end;
HTML Header on that page:
=================
<script language="JavaScript1.1" type="text/javascript">
function get_List_XML (source_item,target_item){
var v_Target = html_GetElement(target_item);
var v_Source = html_GetElement(source_item);
var ajaxResult = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=POPULATE_LIST_XML',0);
ajaxResult.add('TEMP_ITEM',source_item.value);
var v_result_xml = ajaxResult.get('XML');
if(v_result_xml && v_Target)
var options_Contents = v_result_xml.getElementsByTagName("option");
v_Count = options_Contents.length;
v_Target.length = 0;
for(var i=0;i<v_Count;i++)
var v_opt_xml = v_result_xml.getElementsByTagName("option");
appendToSelect(v_Target, v_opt_xml.getAttribute ('value'),v_opt_xml.firstChild.nodeValue)
function appendToSelect(target_item, option_val, option_content) {
var v_Opt = document.createElement("option");
v_Opt.option_value = option_val;
if(document.all){
target_item.options.add(v_Opt);
v_Opt.innerText = option_content;
}else{
v_Opt.appendChild(document.createTextNode(option_content));
target_item.appendChild(v_Opt);
</script>
Form element attribute in the host_name column. P935_INSTANCE_DB_NAME is my page item for database_name.
onchange="get_List_XML (this,'P935_INSTANCE_DB_NAME')"
}
Similar Messages
-
Help with Cascading Select List in Tabular Form
Hello Friends,
I am trying to implement Denes Kubicek's sample for Cascading Select list and ran into this error:
Please help me identify what I might have missed ???
<code>
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
Only one top level element is allowed in an XML document. Error processing resource 'http://apex.oracle.com/pls/apex/f?p=12...
<select><option value="0">- Select Employee (0) -</option></select><html lang="en-us" xmlns:htmld...
</code>
Please find below the list of activities I performed:
1.Created the region source
2.Created the hidden items
3.Created the buttons and items
4.Created the application process for MRU and Delete
5.Created the Application item [ TAB_CASCADING_ITEM]
6.Created the Application Process[tab_casc_sel_list]
Any clue/pointers to debug this are welcome.
I tried the above on apex.oracle.com; WS: CHAITANYAPATCHIPULUSU; USERNAME :[email protected]
PWD:Satya123 in APPLICATION : 12855 and Page :35
Regards..OK, you didn't have the background process as an on demand process.
In the MRU and MRD process, you were referencing the wrong variables for the count. (as in deb's case, it's p176, but in your case its p35).
In the javascript function, the call that is supposed to assign : TAB_CASCADING_ITEM a value, isn't working (I believe). -
F4 HELP FOR ONLY SELECTED FIELD VALUES
Hi,
I have to display the F4 help for the selection screen field parameter. From the ICON table, I need to display the field ID values. In the ICON table, I have lot of field values for the field ID, but I need to display only 3 field values into F4 help.(like say @07@, @08@, @0A@ only at the F4 help).
Thanks in advance.
Regards
Ramesh mavilla.Hi,
See the follwoing code example
REFRESH: I_DYNPREAD .
CLEAR : I_DYNPREAD .
I_DYNPREAD-FIELDNAME = 'P_KAPPL'.
APPEND I_DYNPREAD.
CLEAR I_DYNPREAD.
L_REPID = SY-REPID .
L_DYNNR = '1000' .
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = L_REPID
DYNUMB = L_DYNNR
TABLES
DYNPFIELDS = I_DYNPREAD.
IF SY-SUBRC EQ 0.
READ TABLE I_DYNPREAD INDEX 1.
P_KAPPL = I_DYNPREAD-FIELDVALUE.
ENDIF.
REFRESH: I_DYNPREAD .
CLEAR : I_DYNPREAD .
REFRESH: I_KSCHL.
TRANSLATE P_KAPPL TO UPPER CASE.
TRANSLATE P_KVEWE TO UPPER CASE.
SELECT KAPPL KVEWE KSCHL VTEXT FROM T685T
INTO CORRESPONDING FIELDS OF TABLE I_KSCHL
WHERE KAPPL = P_KAPPL
AND KVEWE = P_KVEWE
AND SPRAS = 'EN'.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ) WITH 'No Condition Type exist for Application'.
*p_kappl ' and Usage' p_kvewe.
ELSE.
REFRESH: I_FIELDS.
I_FIELDS-TABNAME = 'T685T'.
I_FIELDS-FIELDNAME = 'KAPPL'.
I_FIELDS-SELECTFLAG = ''.
APPEND I_FIELDS.
I_FIELDS-TABNAME = 'T685T'.
I_FIELDS-FIELDNAME = 'KVEWE'.
I_FIELDS-SELECTFLAG = ''.
APPEND I_FIELDS.
I_FIELDS-TABNAME = 'T685T'.
I_FIELDS-FIELDNAME = 'KSCHL'.
I_FIELDS-SELECTFLAG = 'X'.
APPEND I_FIELDS.
I_FIELDS-TABNAME = 'T685T'.
I_FIELDS-FIELDNAME = 'VTEXT'.
I_FIELDS-SELECTFLAG = ' '.
APPEND I_FIELDS.
CLEAR: V_SEL.
CALL FUNCTION 'HELP_VALUES_GET_NO_DD_NAME'
EXPORTING
CUCOL = 0
CUROW = 0
DISPLAY = ' '
SELECTFIELD = 'KSCHL'
TITEL = 'Cond Type'
IMPORTING
IND =
SELECT_VALUE = V_SEL
TABLES
FIELDS = I_FIELDS
FULL_TABLE = I_KSCHL
IF SY-SUBRC = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF. "SY-SUBRC.
And also go throw the link which it clears more about F4
Check the link below for creating collective search help
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee86446011d189700000e8322d00/content.htm
Check the ink below for creating elementary search help
http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21ee5f446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/3d/e53642e2a3ab04e10000000a1550b0/content.htm
<b>Reward with points if helpful.</b>
Regards,
Vijay -
One search help for multiple select-options in webdynpro abap
Hi,
I need a way to use one search help for multiple select-options fields. My scenario is :
I have a table for keeping different organizational units' values of different systems. I have pasted some sample data from this table at the end of this mail. On the screen I want to have 1 select-options filed for werks, and 1 select-options filed for vkorg. (In fact I will have more org. unit fields...) In the beginning of my application the user will select sid.
If the user selects ADS as SID, when he opens search-help for the first org. unit (werks), he will see the records with SID: ADS, VARBL = $WERKS, LANGU = SY-LANGU.
If the user selects AGT as SID, when he opens search-help for the second org. unit (vkorg), he will see the records with SID: AGT, VARBL = $VKORG, LANGU = SY-LANGU.
I have created a search-help taking SIDD, VARBL and LANGU as import parameters; used field mapping and bound this search help to my table. I have created 2 context nodes : org1 and org2 having attributes SID, VARBL, VALUE, LANGU .
I have assigned related SID, VARBL and Langu values to these attributes at runtime as I needed. That way, if I use input field and reference to the related context attributes org1-value and org2-value2 accordingly, search help works well as I want.
However, when I use select-options field , I can not bind the field to the context data. I can give reference only to ddic structure. Is there any way to reference to a context attribute? I searched for this in SDN, but could find nothing.
I think I won't be able to use this way. What do you say?
As I read from forums maybe using OVS help will be suitable for me. But I have to use one search-help for all select-options fields. Do you know how I can determine the active select-options field and pass its name (for instance "werks" ) as parameter to this OVS search help. (Also I'll pass SID and LANGU.)
MY TABLE (ZBYYT080) CONTENTS:
SID VARBL VALUE LANGU VTEXT
ADS $WERKS 1 T Werk 0001
ADS $WERKS 11 T OZYAS GIDA URETIM YERI
ADS $WERKS 5501 T BOYA GEBZE FABRİKASI
ADS $WERKS 5502 T BOYA CIGLI FABRİKASI
AGT $WERKS 2301 T KAMLI DAMIZLIK
AGT $WERKS 9601 T PANAR DENIZ URETIM YERI
ADS $VKORG 22 T AA KİMYASALLAR
ADS $VKORG 8001 T İINSAAT BOYALARI
AGT $VKORG 6500 T DAMk St.Org
AGT $VKORG 5400 T PANAR St.Org.
I wish I'm clear enough..
I will be gald if someone answers me as soon as possible...
Thanks İn advance..
MERALHi,
Your ques is how to refer to a DDIC search help to refer to selection screen parameter ?
Am I right ?
If Yes, then in the interface IF_WD_SELECT_OPTIONS
method ADD_SELECTION_FIELD, ADD_PARAMETER_FIELD etc
have importing param like I_VALUE_HELP_TYPE and I_VALUE_HELP_ID, I_VALUE_HELP_MODE, I_VALUE_HELP_STRUCTURE
etc which may help you to link your create DDIC Search help to selection screen params.
this is just a clue from my side. I haven't tried it myself.
You can go to the where used list of this method and find some sample implementations which use these params.
Hope this helps.
Regards
Manas Dua -
F4 Help for the selection screen field
Hi Gurus,
I have to display F4 help for a selection screen field. i am using following code:
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CODE'
dynpprog = lw_repid
dynpnr = sy-dynnr
VALUE_ORG = 'S'
TABLES
value_tab = gi_text
field_tab = li_fields_tab
return_tab = pi_return_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
My internal table gi_emp has two fields CODE & TEXT. When i select 1 particular value, it returns the CODE value in the pi_return_tab table.
But my requirement is i have to capture the corresponding TEXT value for the Returned CODE. Ex: following is the F4 help being displayed: -
001 test
001 test1
but is i select code 001(First Value), i also need to capture it's corresponding Text value. In return table pi_return_tab i have only Code value.
Please help me out.
Note: Based on return code i can't search into the internal table gi_code, because as shown in the example, code has multiple text.Sachin,
I think this is what you need. The following code will return the key and the text (OR any other columns), if both columns are in the selection screen the selected values (both columns) will also be passed to the corresponding parameters. If you only need the text to be in the return table and not passed to the selection screen then set the parameter for text with NO-DISPLAY option.
REPORT zktest01 .
DATA :
BEGIN OF value_tab OCCURS 0,
field LIKE e070-trkorr,
text LIKE e07t-as4text,
END OF value_tab.
DATA: t_fldtab LIKE dfies OCCURS 0 WITH HEADER LINE,
t_rettab LIKE ddshretval OCCURS 0 WITH HEADER LINE,
t_dynmap LIKE dselc OCCURS 0 WITH HEADER LINE.
PARAMETERS : p_field LIKE value_tab-field,
p_text LIKE value_tab-text. "NO-DISPLAY.
INITIALIZATION.
t_fldtab-tabname = 'VALUE_TAB'.
t_fldtab-fieldname = 'FIELD'.
t_fldtab-langu = 'E'.
t_fldtab-position = 1.
t_fldtab-offset = 0.
t_fldtab-fieldtext = 'Key'.
t_fldtab-reptext = 'Key'.
t_fldtab-leng = 20.
t_fldtab-intlen = 20.
t_fldtab-outputlen = 20.
t_fldtab-datatype = 'CHAR'.
t_fldtab-inttype = 'C'.
t_fldtab-headlen = 20.
t_fldtab-keyflag = 'X'.
t_fldtab-lowercase = ' '.
APPEND t_fldtab.
t_fldtab-tabname = 'VALUE_TAB'.
t_fldtab-fieldname = 'TEXT'.
t_fldtab-position = 2.
t_fldtab-offset = 20.
t_fldtab-fieldtext = 'Text'.
t_fldtab-reptext = 'Text'.
t_fldtab-leng = 60.
t_fldtab-intlen = 60.
t_fldtab-outputlen = 60.
t_fldtab-headlen = 60.
t_fldtab-keyflag = ' '.
t_fldtab-lowercase = ' '.
APPEND t_fldtab.
value_tab-field = '101'.
value_tab-text = 'dddd'.
APPEND value_tab.
value_tab-field = '202'.
value_tab-text = 'aaaa'.
APPEND value_tab.
t_dynmap-fldname = 'FIELD'.
t_dynmap-dyfldname = 'P_FIELD'.
APPEND t_dynmap.
t_dynmap-fldname = 'TEXT'.
t_dynmap-dyfldname = 'P_TEXT'.
APPEND t_dynmap.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'FIELD'
dynpprog = 'ZKTEST01'
dynpnr = '1000'
dynprofield = 'P_FIELD'
value_org = 'S'
TABLES
field_tab = t_fldtab
value_tab = value_tab
return_tab = t_rettab
dynpfld_mapping = t_dynmap
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc EQ 0.
ENDIF.
START-OF-SELECTION.
Jeffrey Satriadi -
How to add Document group in t code S_ALR_87012082 for dynamic selection.
Hi Gurus,
I Need to add Document group in t code S_ALR_87012082 for dynamic selection.
Currently here two groups are showing , Vender and Comp Code. i need to add Document group there. Kindly guide me in this.
Thanks in advance.Hi
Pls follow below report
*S_ALR_87012103 - List of Vendor Line Items *
In dynamic selections you can find Document number, there you can give the range
Reg
Vishnu -
Search help for PERNR select options in Webdynpro
Hi,
I am using the method: lv_r_helper_class->add_selection_field
and passing the value:
i_value_help_type = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
to get search help for pernr select option in the webdynpro application.
But can anyone please tell me what value i have to pass to
i_value_help_id = ??hi,
pass your search help name there so that your desired search help ll come there..
use this,
i_value_help_type = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
i_value_help_id = 'SEARCHHELPNAME'
if you want standard SH means comment this stmt,
if you dont want SH means,
use tis,
i_value_help_type = if_wd_value_help_handler=>CO_PREFIX_NONE
hope this helps,
Mathan R. -
Can we create serach help for a selection screen field
Can we create serach help for a selection screen field with out creating searchhelp object.
I mean is it possible to create serchelp in the program itself with some specific values i want to give.
E.g say we can define any internal table and fill it with values and using that into selection screen fields
Regards
MaveAT SELECTION-SCREEN ON VALUE-REQUEST FOR paymeth.
PERFORM PAYMENT_HELP.
FORM PAYMENT_HELP.
DATA: begin of DESCR_TAB occurs 0,
DESCR LIKE BKPF-BKTXT,
END OF DESCR_TAB.
DATA: gd_repid like sy-repid.
gd_repid = sy-repid.
DESCR_TAB-DESCR = 'aaaaa'.
append DESCR_TAB.
DESCR_TAB-DESCR = 'bbbbb'.
append DESCR_TAB.
DESCR_TAB-DESCR = 'ccccc'.
append DESCR_TAB.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'DESCR'
DYNPPROG = gd_repid
DYNPNR = '1000'
DYNPROFIELD = 'paymeth'
VALUE_ORG = 'S'
DISPLAY = ' '
TABLES
value_tab = DESCR_TAB.
endform.
Svetlin -
Search help for a select options
Hi ,
I need to place a search help for a select-options field on my report selection screen. It should work for a z-table field . I can create a search help for the Z-table field , but I do not know how to make it available for the select-options.
Thank you .hi Krish,
SELECT OPTIONS ... MATCHCODE OBJECT name_of_search_help.
hope this helps
ec -
Question For Vikas: Select List Colors
Vikas,
I've seen somewhere
you posted a site:
http://htmldb.oracle.com/pls/otn/f?p=24317:104
Can you still do that with an htmldb_item.select_list?
If yes how can you do that because I've been struggling
for weeks to find this answer and all of a sudden now
I've seen your example
Thank youMy example is a variant of the master's example (Carl Backstrom) of a similar nature.
Basically, the styling is done with a Javascript in the region footer, so you can apply it to anything. The code is
var pThis = document.getElementById('P104_SELECT');
var pThose = pThis.getElementsByTagName('OPTION');
for(var j=0;j < pThose.length;j++){
pThose[j].style.background = pThose[j].value;
}Basically, the select list option value itself is the color name.
Things get a little trickier in a tabular form because you have many select lists, but I think the basic concept should hold good. The above code just grabs a specific select list and loops over its options. You would need to wrap it in another loop to grab all the select lists in your tabular form and do the same thing.
Hope this helps. -
Sample JSP code needed with jdbc select lists
Hello java experts!
I need to create a series a jsp pages that connects to an ms access "books" database. This first page should connect to the books.mdb and populate select lists with the values from the database. The solution would be similar to the the books shopping cart in the CoreServlets book, EXCEPT I must do everything in JSP only.
All I have done to this point is Java servlets. (I've done shopping cart stud in ASP.net, but not JSP).
I know everyone hates to post code samples, but seeing the code will help me understand. I've read the API, the tutorials, 3 textbooks, and any other doc I could find. I understand Java beans and jsp, but I need to see the JSP for this to finally crystalize.
Thanks in advance.
-JavaGirlwhat school is teaching db access from jsp?
-
How do I get the list index for the selected list item
How can I obtain the list index for the currently selected
element in a list item? I'm trying to move the label and value
from on list box to another by using the add_list_element built-
in and it requires the list index.
Thanks for your help...Hi,
You can`t get the Index for the selected item..
you can get the Value of then Tlist using :Block.ListName .
maybe theis code will help you..
PROCEDURE pr_PasarElementos(ls_Origen varchar2, ls_destino varchar2, cValor varchar2 default null) IS
nCont_Orig number := 0;
nCont_Dest number := 0;
begin
nCont_Orig := GET_LIST_ELEMENT_COUNT(ls_Origen); nCont_Dest := GET_LIST_ELEMENT_COUNT(ls_destino);
Add_List_Element(ls_destino,nCont_Dest+1,cValor,cValor);
for rec_Orig in 1..nCont_Orig loop
if GET_LIST_ELEMENT_VALUE(ls_Origen,rec_Orig) = cValor then
delete_list_element(ls_Origen,rec_Orig);
end if;
end loop;
end;
you can call the procedure with :
pr_pasarElementos('control.ls_activos','control.ls_inactivos',:CONTROL.ls_activos);
here I`m working with the Value equal to the Label... you would need to look for the Label of the origin (ls_Origen) list using the Value (cValor) you already have.
I hope this help you. -
Generic solution for cascading select lists/lovs
After implementing several times a select list/lov, which is depending on another item on the same page (see the AJAX example from Carl Backstrom), I thought that it was time to come up with a more generic solution where I don't have to implement javascript code and on-demand processes for each lov anymore.
I want to contribute my findings to the APEX community. More details about my solution can be found at
http://inside-apex.blogspot.com/2006/11/generic-solution-for-depending-select.html
Any feedback is welcome!
Patrick
My APEX blog http://inside-apex.blogspot.comHi Bjorn,
the "First schema provisioned" property is just available in "normal" workspaces, not in the "internal" workspace. But it's just the schema-name where the tables/... of your application are stored.
About your problem. Which version do you use? V2.0?
V2.0 doesn't have the APEX dictionary views, I think they have been created in V2.2.
So the only way to use my solution is to use the version which is stored into the FLOWS_... schema. But it has to be modified before.
1.) In the ApexLib.js file, all ocurrences of $x have to be replaced by html_GetElement => $x doesn't exist in V2.0
2.) Replace the FLOWS_020200 thru FLOWS_020000 in the header of the package (ApexLib_for_flows_020200.pks and .pkb)
3) Maybe you have to remove the where-clause restriction NVL(UPPER(ITEM_COMMENT), '@') NOT LIKE '%$APEXLIB_IGNORE_LOV$%', I'm not sure if the comment column exists in V2.0. Don't have a possibility to check that now.
I will come up with a solution on sunday or monday.
Patrick -
Problem writing a sql query for a select list based on a static LOV
Hi,
I have the following table...
VALIDATIONS
ID Number (PK)
APP_ID Number
REQUESTED Date
APPROVED Date
VALID_TIL Date
DEPT_ID Number (FK)
I have a search form with the following field item variables...
P11_DEPT_ID (select list based on dynamic LOV from depts table)
P11_VALID (select list based on static Yes/No LOV)
A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
SELECT v.APP_ID,
v.REQUESTED,
v.APPROVED,
v.VALID_TIL,
d.DEPT
FROM DEPTS d, VALIDATIONS v
WHERE d.DEPT_ID = v.DEPT_ID(+)
AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
Can anyone help me to extend my query to include this situation?
Thanks.Hello !
Let's have a look at my example:create table test
id number
,valid_til date
insert into test values( 1, sysdate-3 );
insert into test values( 2, sysdate-2 );
insert into test values( 3, sysdate-1 );
insert into test values( 4, sysdate );
insert into test values( 5, sysdate+1 );
insert into test values( 6, sysdate+2 );
commit;
select * from test;
def til=yes
select *
from test
where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
=decode('&til','yes',1,-1);
def til=no
select *
from test
where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
=decode('&til','yes',1,-1);
drop table test; It's working fine, I've tested it.
The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
For understandings:
1.) TRUNC removes the time part of DATE
2.) The difference of to date-values is the number of days between.
3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
4.) DECODE is like an IF.
Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
Good luck,
Heinz -
F4 help for the selection screen field designed in screen painter
Hi all,
I have designed selection screen in the screen painter. in that for one of the fields i have to give f4 help. for that i have writter the code in PAI event. in this event i have used the standard Function module for f4 help. but no f4 help is comming for that field. can any body suggest what i have to do.
Thanks & Regards,
Giri.Hi,
You must use the correct event to meet ur requirement use POV event instead of PAI event.
for more clarification and example program see below the demo program
DEMO_DYNPRO_F4_HELP_DYNPRO
DEMO_DYNPRO_F4_HELP_MODULE
Cheers
fareed
Maybe you are looking for
-
Capturing DVCAM in FCP 6.0.2 and encountering strange capture behavior
I have FCP 6.0.2 and OSX 10.5.2 and QT 7.3.1. I have been capturing several DVCAM cassettes using my Sony DSR-20 deck. Although I have done this countless times before in earlier versions of FCP, I am encountering some strange repetitive behavior. I
-
Using LR2 w/ Photoshop CS2 and Camera Raw 3.7
I am using Photoshop CS2 and Camera Raw 3.7 on a Mac G4, OS X 10.4.11. I am about to install my upgrade to Lightroom 2. Is this a bad idea? I have read about some compatibility issues re Camera Raw, and I have also read about how to solve the issue o
-
Apple's refusal to go with a universal micro USB has just persuaded me to buy my first galaxy. Nice to have your mind made up for you. Thanks apple. Is it pure greed or just cynical self-importance?
-
Report for chart of accounts by transaction
Hi All, I am looking for Report for chart of accounts by transaction. Could any one suggest me which report it is. Thanks, JP
-
Customclass accessing children
Hi there, I made a search looking for custom class problems but didn`t find anything about what I`m having trouble with. Witch I thought to be pretty weird. I think I may be doing something stupid. I have a customScrollBar_mc in my library which cons