Focal Point
[SOLVED] MAINTAIN using a multilist selection to filter a stack

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

October 27, 2011, 07:00 PM
jjoyce
[SOLVED] MAINTAIN using a multilist selection to filter a stack
I have a maintain form with a multilist that is filled using a stack.

I would like to use the selected values from the multilist box as a filter to filling another stack.

So the user selects a few things from that list and hits go; this calls a function that fills a stack as follows (BEG_DT and END_DT are also fields on my form):

For all next readmit_30_day.READMIT_30_DAY.RECORD_ID into stk
Where (DEPARTMENT IN ([selection list]))
AND (ADMIT_DT2 GE BEG_DT)
AND (ADMIT_DT2 LT END_DT);

I'm pretty sure I could fill this stack by passing these values from the form to a fex, then execing the fex into the stk, but I was wondering if there was any way of referencing this list of selected items directly in the where clause in maintain? Seems like a lot of extra work to go with the fex route, as I'm pretty sure I'll have to concatenate all the values into one string and one parameter since I don't know how many items the user might select.

This message has been edited. Last edited by: jjoyce,


WebFOCUS 7.7.2
Win2003
Excel, HTML, PDF
October 28, 2011, 08:18 AM
Maintain Wizard
This can easily be done with Maintain.

Let's assume that DEPTSTK contains the list of selected departments. We loop through the selected values and load the proper records into the stack one selection at a time. We would do this:

compute i/i3=1;
repeat deptstk.foccount
reposition readmit_30_day.READMIT_30_DAY.RECORD_ID
For all next readmit_30_day.READMIT_30_DAY.RECORD_ID into stk(stk.foccount+1)
Where DEPARTMENT eq deptstk(i).department
AND (ADMIT_DT2 GE BEG_DT)
AND (ADMIT_DT2 LT END_DT);
compute i=i+1;
ENDREPEAT
Stack Sort STK by RECORD_ID

Mark
October 28, 2011, 11:20 AM
jjoyce
Awesome!

This worked beautifully except for one small thing. deptStk is my display list and thus has all the departments regardless of which ones I selected. I created a second stk, bound it to the selection result of my field, and then used it in the Where statement and I got exactly what I needed.

Thanks Mark!


WebFOCUS 7.7.2
Win2003
Excel, HTML, PDF