Focal Point
[CLOSED] Need logic for passing single or multiple values in single parameter from UI

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

September 23, 2014, 05:31 AM
Maddy1
[CLOSED] Need logic for passing single or multiple values in single parameter from UI
Hi All,

Currently i'm using the below logic for passing single or multiple values like below.And below code i'm using

(APP-1 &RPT_VALUE L00000 (ONLY SINGLE value)),
(APP-2 &RPT_VALUE EXAMPLE ('L00000') OR ('L00000','L00001','L00002') SINGLE OR MULTI Values



-SET &RPT_VALUE_1=TRIMV('B',UPCASE(600, &RPT_VALUE, 'A600'),600,' ',600,'A600V') ;
-SET &PIN_IN = &RPT_VALUE_1.LENGTH;
-SET &PINCHK_2 = STRREP(&PIN_IN,&RPT_VALUE_1,1,'(',0,'',&PIN_IN,'A&PIN_IN.EVAL');
-SET &PINCHK_2 = STRREP(&PIN_IN,&PINCHK_2,1,')',0,'',&PIN_IN,'A&PIN_IN.EVAL');
-SET &PINCHK_2 = STRREP(&PIN_IN,&PINCHK_2,1,'''',0,'',&PIN_IN,'A&PIN_IN.EVAL');
-SET &PINCHK_2 = TRUNCATE(&PINCHK_2);

But i need the logic for below process.I tried in different ways not working.

(APP-1 &RPT_VALUE L00000 (ONLY SINGLE value)),
(APP-2 &RPT_VALUE EXAMPLE L00000 OR L00000|L00001|L00002 SINGLE OR MULTI Values.

Thanks..

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


WebFOCUS 7.7.03 Windows 7, Excel,HTML,PDF
September 23, 2014, 08:32 AM
MartinY
This replace the pipe | by a comma :
-SET &RPT_VALUE = 'L00000|L00001|L00002';
-SET &RPT_VALUE_1=TRIMV('B', UPCASE(600, &RPT_VALUE, 'A600'), 600, ' ', 600,'A600V') ;
-SET &PINCHK_2 = STRREP(&RPT_VALUE_1.LENGTH, &RPT_VALUE_1, 1, '|', 1, ',', &RPT_VALUE_1.LENGTH, 'A&RPT_VALUE_1.LENGTH');
-SET &PINCHK_2 = TRUNCATE(&PINCHK_2);

-TYPE &PINCHK_2


But if the possible values are coming from a control list you can check on the Multiple option. Your issue here is to manage the pipe sign which is a concatenator in IBI. Having &RPT_VALUE enclosed by quotes, it works otherwise the pipe sign is not passed because it concatenate the values.

Why are you trying to manage pipes and where they come from ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 23, 2014, 10:02 AM
Maddy1
User is expecting 123|124|125 in place of passing ('123','124','125') pipe isd used to jst divided the value


WebFOCUS 7.7.03 Windows 7, Excel,HTML,PDF
September 23, 2014, 10:19 AM
Maddy1
Martin
the above logic is not working,yes you are correct pipe is used for concatenate the values otherwise in place of ('A123','A124','A125') ----->to pass like this A123,A124,A125,so it will display the forms for the given pin each
A123
A124
A125


WebFOCUS 7.7.03 Windows 7, Excel,HTML,PDF
September 23, 2014, 11:46 AM
MartinY
Why passing 123|124|125 ? This is just a display for the user on the UI, isn't it ?

Pass 'A123','A124','A125' to your fex and display 123|124|125 to the user.

You can create a list such as this (sample may look stupid but just to show you the technic) :
DEFINE FILE CAR
LST   /A32V = COUNTRY || '|' || COUNTRY || '|' || COUNTRY;
CD    /A32V = COUNTRY || ',' || COUNTRY || ',' || COUNTRY;
END
TABLE FILE CAR
PRINT LST
BY CD
-*ON TABLE PCHOLD FORMAT XML
END

With FORMAT XML it become a valid format for UI.

Where the available values are coming from, a TABLE file ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 24, 2014, 02:22 AM
Maddy1
Martin,
I will try to explain you clearly,Example assume that they are 100 people working in a company for those employees has unique id called EMPID,5 people are resigned from that company.so the HR will pass 1 or 3 or 5 EMPID at a time(In UI he will check the check box) to generate those relieving letter forms.for those currently in webfocus we are accepting like belo
1) &EMPID ('L00000') OR L00000 (ONLY SINGLE value)),
2) &EMPID EXAMPLE ('L00000','L00001','L00002','L0003','L0004') MULTI Values.

I need L0000(single value)
L0000,L0001,L0002(multiple values
or
L0000|L0001|L0002


WebFOCUS 7.7.03 Windows 7, Excel,HTML,PDF
September 24, 2014, 07:51 AM
MartinY
Hi Maddy1,

You don't need to manage the pipe or the comma.

Instead of having check boxes, in your UI you just need a control list box having "Multiple" property set to "Multiple" and because it's alpha value, you should also have property "Multiple : Add quotes" set to "Yes".

Because you've checked "Multiple" property, WF will manage the single or multiple selection made by your user and format the values list accordingly.

You just need a fex that will create a list of available values (in your case a list of EMPID) that can probably be retrieved from a table somewhere.

Managing multiple selection is better using list box than check box. The list box is built for that.

In below example, CARMODEL (the PRINT field) it's what the user see on the UI but MODEL (the BY field) it's what the parameter has as value :
DEFINE FILE CAR
CARMODEL /A45V = CAR || ' - ' | MODEL;
END
TABLE FILE CAR
PRINT CARMODEL
BY MODEL
ON TABLE PCHOLD FORMAT XML
END

And having a control list box using that code with proper properties, the user can process multi or single selection.

Then, if you need the selection made formatted in a specific way to pass it to a third party let say, it's going be easier to do it because your received parameter (the user selection) will always be in the same format. Such as for a single selection : 'L00000'
or for multiple selection : 'L00000' OR 'L00001' OR 'L00002'

So using STRREP you can remove the quotes and the OR if they are not needed.

If not clear enough, I'm suggesting you to contact IBI to have a remote session where someone can show you what I'm trying to explain.

Maybe I'm still missing some elements to understand your issue, but from what I'm understanding, this is the solution.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 25, 2014, 10:36 AM
Maddy1
Martin,

Thanks for your information.Basically values are getting from java end i will accept those values and given Compound PDF pages.


WebFOCUS 7.7.03 Windows 7, Excel,HTML,PDF