Focal Point
[SOLVED] retreive values from multiselect drop down list, hold in a temporary table

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1507062136

June 04, 2013, 07:40 AM
Sivakumaran Elangovan
[SOLVED] retreive values from multiselect drop down list, hold in a temporary table
I am having a multiselect listbox named "listbox".
The list box holds the values as "DDD-CC-IIII". So if there are three items selected in listbox by user on submitting the form, i need to hold in a table like below.
Say Item1 in listbox->DDD-CC-III
Item2 in listbox->DDD-CC-III
Item3 in Listbox->DDD-CC-III

Now, I need an output like

Hold file or any other file/table such as
Columns DDD, CC, IIII containing values like
|DDD|CC|III
|DDD|CC|III
|DDD|CC|III

containing 3 rows and I need to use it for further processing.
To achieve this,
I am calling a fex file which in turn retrieve the selected values from the list box thro a repeat loop and assigning the splitted values to the dynamic variables set thro GETTOK function. Now, I am stuck with how to move this dynamic SET variables to TABLE/FILE/or a hold.

Please find below my code:

SQL SQLMSS PREPARE SQLOUT2 FOR
SELECT * FROM PMR_RPT_PMTN_ITEM_DISC
END


-TYPE &customselect6_selectto0
-REPEAT END_1 FOR &N FROM 1 TO &customselect6_selectto0 STEP 1
-TYPE &N
-SET &PARAM=&customselect6_selectto.&N;
-SET &PLEN=&PARAM.LENGTH;
-TYPE &PARAM
-SET &DEPT.&N=GETTOK(&PARAM, &PARAM.LENGTH,1,'-',&PARAM.LENGTH,'A&PARAM.LENGTH');
-SET &CLAS.&N=GETTOK(&PARAM, &PARAM.LENGTH,2,'-',&PARAM.LENGTH,'A&PARAM.LENGTH');
-SET &ITEM.&N=GETTOK(&PARAM, &PARAM.LENGTH,3,'-',&PARAM.LENGTH,'A&PARAM.LENGTH');
-TYPE DEPT:&DEPT.&N
-TYPE CLAS:&CLAS.&N
-TYPE ITEM:&ITEM.&N
-TYPE &PLEN

-END_1

this code will give the value of Dept1, dept2, dept3, class1, class2, class3 and so for item.

Please correct me if my approach is wrong. Please respond soon. Thanks for the big help!

Eeker

This message has been edited. Last edited by: <Kathryn Henning>,


Webfocus 7.6
Excel, HTML, PDF
June 05, 2013, 03:27 PM
ebaig
Here is something to get you started:
  
FILEDEF MASTER DISK dataset.mas
-RUN

-WRITE MASTER FILE=DATASET, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=DATASET, SEGTYPE=S0, $
-WRITE MASTER FIELDNAME=DEPT, ALIAS=DEPT, USAGE=A03, ACTUAL=A03, $
-WRITE MASTER FIELDNAME=CLASS, ALIAS=CLASS, USAGE=A02, ACTUAL=A02, $
-WRITE MASTER FIELDNAME=ITEM, ALIAS=ITEM, USAGE=A03, ACTUAL=A03, $

FILEDEF DATASET DISK dataset.txt
-RUN

-WRITE DATASET DDDCCIII
-WRITE DATASET DDDCCIII



When executing the -WRITE to the file DATASET simply create a loop that runs the number of entries/options the user selected.

Erfan


WebFOCUS 77, Windows, HTML PDF EXCEL
June 06, 2013, 03:36 AM
Sivakumaran Elangovan
Will it be possible to have the sql query inside repeat loop?

Like Repeat
Set=Dynamic variable
**SQL QUERY where col_name="&_dynamic variable*
hold output in a temp file
END REPEAT


Webfocus 7.6
Excel, HTML, PDF
June 07, 2013, 03:12 AM
Sivakumaran Elangovan
Thanks ebaig.. Can u please explain how this filedef is working?

This message has been edited. Last edited by: Sivakumaran Elangovan,


Webfocus 7.6
Excel, HTML, PDF
June 07, 2013, 06:39 AM
Sivakumaran Elangovan
Thanks Ebaig.

Issue resolved with your help.Thanks a lot! Smiler


FILEDEF MASTER DISK dataset.mas
-RUN

-WRITE MASTER FILE=DATASET, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=DATASET, SEGTYPE=S0, $
-WRITE MASTER FIELDNAME=DEPT, ALIAS=DEPT,USAGE=A50,ACTUAL=A50,$
-WRITE MASTER FIELDNAME=CLASS, ALIAS=CLASS,USAGE=A50,ACTUAL=A50,$
-WRITE MASTER FIELDNAME=ITEM, ALIAS=ITEM, USAGE=A50,ACTUAL=A50,$

FILEDEF DATASET DISK dataset.FTM (APPEND
-RUN


-REPEAT END_1 FOR &N FROM 1 TO &customselect6_selectto0 STEP 1
-SET &PARAM=&customselect6_selectto.&N;
-SET &PLEN=&PARAM.LENGTH;
-SET &DEPT.&N=GETTOK(&PARAM, &PARAM.LENGTH,1,'-',&PARAM.LENGTH,'A&PARAM.LENGTH');
-SET &CLAS.&N=GETTOK(&PARAM, &PARAM.LENGTH,2,'-',&PARAM.LENGTH,'A&PARAM.LENGTH');
-SET &ITEM.&N=GETTOK(&PARAM, &PARAM.LENGTH,3,'-',&PARAM.LENGTH,'A&PARAM.LENGTH');
-RUN
-WRITE DATASET &DEPT.&N &CLAS.&N &ITEM.&N
-RUN
-END_1

TABLE FILE DATASET
PRINT *
END


By this code above, I could able to get all the parameters that the user select in the UI and I could able to store them in the hold file. Thanks a lot!

This message has been edited. Last edited by: Sivakumaran Elangovan,


Webfocus 7.6
Excel, HTML, PDF
June 07, 2013, 06:54 AM
Sivakumaran Elangovan
Ebaig, But I would like to know how this filedef works.. i wanna know in detail about the usage.

why we are giving two filedef's herE?

FILEDEF MASTER DISK dataset.mas
-RUN

-WRITE MASTER FILE=DATASET, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=DATASET, SEGTYPE=S0, $
-WRITE MASTER FIELDNAME=DEPT, ALIAS=DEPT,USAGE=A50,ACTUAL=A50,$
-WRITE MASTER FIELDNAME=CLASS, ALIAS=CLASS,USAGE=A50,ACTUAL=A50,$
-WRITE MASTER FIELDNAME=ITEM, ALIAS=ITEM, USAGE=A50,ACTUAL=A50,$

FILEDEF DATASET DISK dataset.ftm (APPEND
-RUN

Can u pls elaborate from the above code?

How RUN Command works?


Webfocus 7.6
Excel, HTML, PDF
June 08, 2013, 06:57 AM
Alex
You'll find all yu need to know about FILEDEF in documentation. Alternatively go to the IBI tech support site and search on FILEDEF. You get several pages of hits.


WF 7.7.04, WF 8.0.7, Win7, Win8, Linux, UNIX, Excel, PDF