Page 1 of 2

Dynamic drop down

Posted: Thu Nov 13, 2014 3:10 am
by regu400
Hi Team

I am very new to Profound, but have experience of about 10 years in RPG programming. We are trying to modify our dspf with profound and I have a doubt in dynamic drop down.

Here, I have created a menu screen using Profound UI where the user can select Main menu and sub menu. When the user clicks submit button, the program related to the submenu should be called.

For this I have created a PF, to store Main menu, sub menu and the calling program details. I also loaded the Main menu details directly into the screen using the dynamic drop down properties.

Here, I have problem with populating the submenu entries. The submenu should be loaded based on the value selected on the Main menu. Could anyone please help me on this

Regards
Regu

Re: Dynamic drop down

Posted: Thu Nov 13, 2014 12:04 pm
by negley
How do your menu's work? Is it two drop downs, the first being the main menus and the second as sub menus?

Re: Dynamic drop down

Posted: Thu Nov 13, 2014 1:23 pm
by regu400
Yes. My screen has two dropdowns

Re: Dynamic drop down

Posted: Mon Nov 17, 2014 3:04 am
by Scott Klement
We'd be happy to help.

Can you explain what you've done, and what part doesn't work? Code examples might also be helpful.

Re: Dynamic drop down

Posted: Tue Nov 18, 2014 7:31 am
by regu400
Hi Scott

Please find the details as below.

MY REQUIREMENT:
I have several programs that need to be put up in a menu screen. For this, I have created a screen in profound that has main menu and submenu. First the user should select the main menu. Then , the submenu entries should be populated based on the main menu selected. After which, the user can press the SUBMIT button to go to the preferred sreen.

OBJECTS:
MENUF: This physical file holds all the main menu, submenu , calling program details. I have attached a file structure and sample screenshot of the entries

MENUFM :This is the display file that has two drop downs and two buttons.

1. Drop down 1 : This is the main menu. It is loaded from the MENMAIN field from my MENUF physical file. I have used "choice database field" property to load the value
2. Drop down 2 : This is the submenu. It should be loaded based on the value selected from Main menu. For example, If I select Employee as main menu, then the submenu should automatically populate all the submenus that belong to Employee.
3. Submit : To accept the drop down 1 and drop down 2 parameters and call the respective program
4. Exit : Button, to get out from the screen

MENUR : This is RPGLE program

I also have a CL program that sets the library list and call the MENUR program.

ISSUE:
My issue here is, I am unable to load the submenu based on the entries from the main menu. As of now, I am loading both the menus in the sameway by adding the choice database field correspondingly. So when I launch the MENUR program, both the menu entries are getting loaded at once and as a result I am getting all values in submenu regardless of the selection from MAIN menu.

For the drop down menu, I could see a property "choice selection criteria" but not sure on what should be done for the same. I have attached the source codes of all the objects with this post.

Thanks a lot in advance for your help.

Regards
Regu

Re: Dynamic drop down

Posted: Tue Nov 18, 2014 10:15 am
by negley
The choice selection criteria should work for what you are trying to accomplish.

In javascript, when you change the first main menu select box. You would then apply the selection criteria parameter. After applying the parameter, you will need to refresh the select box. This all can be done with two lines of javascript.

The applyProperty javascript function: http://www.profoundlogic.com/docs/displ ... opValue%29

Re: Dynamic drop down

Posted: Tue Nov 18, 2014 12:02 pm
by regu400
Thank you very much. It is working fine now.

1 thing. I used MENPGM value in choice values field as mentioned in your screenshot. But my program is showing blank value when launched. I checked the same by debugging the source. Please find my updated RPG program as below.

RPG CODE
H DFTACTGRP(*NO)                                                       
H/DEFINE   PROFOUNDUI                                                  
FMENUF     If   E           K DISK                                     
FMENUFM    CF   E             WORKSTN HANDLER('PROFOUNDUI(HANDLER)')   
C                   DOU       BtnExit = *On                            
C                   EXFMT     MenuScr1                                 
C                   EVAL      ERRMSG = '  '                            
C                   IF        BtnSubmit = *On                          
C                   CALL      MENPGM                                   
C                   ENDIF                                              
C                   ENDDO                                              
C                   Eval      *Inlr = *on
Could you please help me on where it is going wrong. Or do I need to perform CHAIN operation using both the dropdowns and retrieve the same from the file?

Regards
Regu

Re: Dynamic drop down

Posted: Tue Nov 18, 2014 12:08 pm
by negley
It will be blank, you will need to use the bound field of dpdown2.

So it would be:

IF BtnSubmit = *On
C CALL dpdown2
C ENDIF

Re: Dynamic drop down

Posted: Tue Nov 18, 2014 1:58 pm
by regu400
Hi negley

I will check this and get back to you. Thanks a lot for your quick reply

Regards
Regu

Re: Dynamic drop down

Posted: Mon Apr 17, 2017 1:50 pm
by devinst
Is there a way to set the a second 'choices parameter value'? I have tried using the property 'choices parameter value 2', but that did not work. Is it named something else?

Thanks.!!