Focal Point
[SOLVED] Maintain - Listbox - Multiselect

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

July 26, 2015, 08:31 AM
Dr. Nick
[SOLVED] Maintain - Listbox - Multiselect
Good morning,

I have an application that uses Maintain to provide the user with a form to select records based on one or more selection criteria. The form has a variety of controls some of which are listboxes. These are multi-select listboxes. The application works well and now I wish to extend the usability to the business users by "pre-filling" the form with the last selections chosen when the form is displayed. For these multi-select listboxes, I use the following syntax which doesn't highlight the first and second items in the listbox.

Winform Show_Inactive FormSearch;
FormSearch.ListBoxIncidentType.SelectedItems(1) = "Hello";
FormSearch.ListBoxIncidentType.SelectedItems(2) = "World";

The Developing WebFocus Maintain Applications document states this technique but the description of each section is not in sync with the entire command structure. I'm using version 7.7.03.

Any ideas?

Thanks...

Nick

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


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
July 27, 2015, 02:51 PM
John_Edwards
If you can't make that run, I would not rule out cookies, which are easy to code and remarkably useful for this kind of thing. I used them to retain the width of table columns on Maintain forms and the end users absolutely loved it.

Include a unique name of the form in the cookie and the items selected for each drop down. Use JavaScript to pre-highlight once the form is loaded.

J.



July 28, 2015, 07:15 AM
Dr. Nick
Hi John,

Cookies may not work here due to the potential volume of pre-selected choices a user can make plus the number of listboxes and other controls - 19 in total. Do you see anything wrong with the syntax I used?

Thanks...

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
July 28, 2015, 07:55 AM
Maintain Wizard
Nick
While I am not sure why that technique isn't working, I'm going to give you an even easier way to do this. The method is, you assign an output stack to the Multi-select List box and preset the values that you want selected in there. I will give you a dynamic and a static example.

Dynamic - I am filling a listbox with the titles from the movies file:

MAINTAIN FILE movies
Case Top
for all next moviecode into liststk
reposition moviecode
infer moviecode into outstk
compute outstk(1).title = 'JAWS'
compute outstk(2).title = 'CABARET';

Notice that liststk contains ALL the titles while outstk, infered from the Movies file, has two values selected. This can be done dynamically, in a loop, from the database.
When you create the list box, select Multiselect = YES and assign Outstk.title to the SelectedItems parameter. When you run, the values listed in Outstk with highlight in liststk.

Static - I am adding these names to my listbox:

ART
DAN
NOREEN
MARK
JUDY
RENEE

I then create outstk2 in my code:

Compute outstk2.names/a10;
compute outstk2(1).names = 'MARK';
compute outstk2(2).names = 'RENEE';

I select Multiselect for the list box and assign outstk2.names as the SelectedItems parameter of the static list box. Now when you run, the two names listed in outstk2 are highlighted on the multi-select list box.

I hope this helps.
Mark
July 29, 2015, 06:59 AM
Dr. Nick
Hi Mark,

The first method works perfectly and it's very logical.

Thank you...

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.