Focal Point
MR Dynamic Dropdowns

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

October 24, 2005, 03:02 PM
KarateExplosion
MR Dynamic Dropdowns
Here is the where clasue in my fex:

WHERE ( SCHEDULE_ID EQ &schedule.(FIND PLANS.SCHEDULE_ID IN PLANS.schedule. )

Here is the code that creates the dyanmic dropdown in my launch page:

<SELECT id=ITEM2 style="Z-INDEX: 5; LEFT: 420px; WIDTH: 150px; POSITION: absolute; TOP: 200px; HEIGHT: 22px" name ="schedule" elementname="combobox2" elementtype="combobox" sourcetype="typeMaster" labelid="ITEM1" caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="0" dynalldisplayvalue="ALL" inchainindex="2" chainnumber="0" cacheruntimedata="0" displayfield="SCHEDULE_ID" numofrecords="-1" datafield="SCHEDULE_ID" datasource="CONSTRUCTION_PLANS.mas" datafieldtype="INTEGER">
</SELECT>

There is also a cloumn in the table user_id which equals IBIMR_user. I need the dropdown to only give schedule_ids for that particular user. How can I restrict the values in the drop down based on the value of the user_id column which = IBIMR_user? Any help is greatly appreciated.
October 24, 2005, 03:42 PM
Tony A
If you are using a fex to launch your HTML page then you can use the "old" method of populating SELECTS.

In you fex include an extract -

FILEDEF CONSSELS DISK CONSSELS.FTM
-RUN
-WRITE CONSSELS <OPTION VALUE=FOC_NONE SELECTED>ALL</OPTION>
-RUN
FILEDEF CONSSELS DISK CONSSELS.FTM (APPEND
-RUN
DEFINE FILE CONSTRUCTION_PLANS
OPTION/A95 = '<OPTION VALUE=' || SCHEDULE_ID || '>' || SCHEDULE_ID || '</OPTION>' ;
END
TABLE FILE CONSTRUCTION_PLANS
PRINT OPTION
WHERE ( SCHEDULE_ID EQ &schedule.(FIND PLANS.SCHEDULE_ID IN PLANS.schedule. )
ON TABLE SAVE AS CONSSELS FORMAT ALPHA
END
-RUN

-HTMLFORM what_ever_your_HTML_is_called

and then in your HTML you would change your SELECT to something like -

<SELECT style="Z-INDEX: 5; LEFT: 420px; WIDTH: 150px; POSITION: absolute; TOP: 200px; HEIGHT: 22px">
!IBI.FIL.CONSSELS;
</SELECT>

The downside to this is that it is no longer controlled by the DHTML methods employed via the ibirls.js javascript module and hence the ability to chain it into relationship with other SELECTS.

The DHTML methods actually use ActiveX to interpret an XML file created using an adhoc fex on the fly (created and executed in the JS) which is why the dynamic chaining works.

To retain the dynamic chaining you could reproduce the IB javascript to build your own XML file on the fly (I have done it but it doesn't make for reuseable code Frowner ).

Have fun establishing your solution and please let us know what you decide upon.

T
October 25, 2005, 09:20 PM
dhagen
This shouldn't be too difficult to do:

First: You need to expose the IBIMR_user as a variable to the WebFOCUS environment. Use the admin console (/ibi_html/wfconsole.htm) under "Configuration/Custom Settings" enter the command:

<set> IBIMR_user(pass)

Now the next time you run a report, there will be a parameter called &IBIMR_user.

Second: Use dev studio to create a procedure to generate a list of schedule_id's. The report should contain only two columns. The first column (the sort or by) should be the schedule_id, while the second can be either the schedule_id or some description. Ensure that you include the where statement to filter on the now available &IBIMR_user. Also, ensuer that you select the output type of "PCHOLD FORMAT XML"

Third: change your dynamic drop down box from table list to the procedure created in the second step.

Forth: Run it.

Hope this helps