Profile picture for user harryratia

Hi,

 

I am creating a report script with a dialogue using drop list boxes. I want the user to be able to select different sales areas as input to the report. Depending on the selection, in the same dialogue I want to offer a second selection to refine the scope.

For instance, if the first drop list box holds two options - "European sales" and "Asias sales" - and the user select "European sales", then the second drop list box should read its contents from an array where the European salses offices are listed. For instance "Denmark","Germany","UK",...

I was first looking at "setDlgListBoxArray" as a candidate to achieve this, but it doesn't seem to be doing what I am looking for here.

 

Have anybody out there tried this before? A helpful hint to the right direction would be appreciated.

/ Harry

by Amol Patil
Posted on Wed, 11/09/2011 - 19:16

Hi Harry,

Please share a snapshot of your code. The method you are using to fill the dropdown list is correct.

Thanks,

Amol Patil

0
by Harry Ratia Author
Posted on Thu, 11/10/2011 - 10:42

In reply to by zramirez

Hi,

First I build two lists (arrays) with countries, one with European countries and one with Asian countries. These are later to be used as values for the drop list boxes. The names of these arrays are "sEuropean_Country_list" and "sAsian_Country_list".

Then the dialogue code looks like this:

// Dialogue begin---------------------------------------------------------------------------------
           var userdialog = Dialogs.createNewDialogTemplate(0, 0, 440, 145, "View selection");
          userdialog.Text(10, 10, 400, 15, "Select the items you want to follow");
          userdialog.Text(10, 25, 400, 15, "Click on OK to finish the report");
          userdialog.GroupBox(7, 55, 426, 55, "Select region");
          // First list box option is picked here:
          userdialog.DropListBox(20, 70, 360, 15, ["European sales","Asian sales"], "sRegion");
          userdialog.GroupBox(7, 120, 426, 55, "Select country");
          // Second list box options, depending on the selection made in the first list box
          userdialog.setDlgListBoxArray ("sRegion" , ???);
//          userdialog.DropListBox(20, 135, 360, 15, sCountry_list, "sSelectedItem");
          userdialog.OKButton();
          userdialog.CancelButton();
          var dlg = Dialogs.createUserDialog(userdialog);
          nuserdialog = __toLong(Dialogs.show( __currentDialog = dlg));          // Displays dialog and waits for the confirmation with OK.     
// End Dialogue ---------------------------------------------------------------------------------       

What I am trying to figure out is what goes in setDlgListBoxArray instead of "???" and what more is possibly missing.

Regards   / Harry

0
by Vladimir Bis
Posted on Tue, 11/29/2011 - 12:48

Hi Harry,

look into help, function createNewDialogTemplate ( int X, int Y, int DX, int DY, String Title, String sDialogFunc ). Use last parameter - sDialogFunc. This function catchs events.

So try use my example

function main(){      
   var userdialog = Dialogs.createNewDialogTemplate(0, 0, 440, 145, "View selection", "dlgFuncOutputOptions");           
   userdialog.Text(10, 10, 400, 15, "Select the items you want to follow");
   userdialog.Text(10, 25, 400, 15, "Click on OK to finish the report");
   userdialog.GroupBox(7, 55, 426, 55, "Select region");           
   // First list box option is picked here:           
   userdialog.DropListBox(20, 70, 360, 15, [" ", "European sales","Asian sales"], "sRegion");   
   userdialog.GroupBox(7, 120, 426, 55, "Select country");           
   // Second list box options, depending on the selection made in the first list box           
   //userdialog.setDlgListBoxArray ("sRegion" , ???); 
   userdialog.DropListBox(20, 135, 360, 15, new Array(), "sSelectedItem");           
   userdialog.OKButton();           
   userdialog.CancelButton();           
   dlg = Dialogs.createUserDialog(userdialog);           
   nuserdialog = Dialogs.show( __currentDialog = dlg);  
}

function dlgFuncOutputOptions(dlgItem, act, suppVal)
{
  var bResult = true;
      
  switch(act)
  {
    case 1:
      // dialog initialization
      dlg.setDlgValue("sRegion", 0);               
      bResult = false;
      break;

    case 2:
       
       if (dlgItem == "sRegion"){
         if (suppVal == 1) // European sales           
           var aCountry = new Array("Slovakia", "Austria", "Russia", act);           
         else if (suppVal == 2) // Asian sales
           var aCountry = new Array("China", "India");
         else
            var aCountry = new Array(); 
                 
         dlg.setDlgListBoxArray("sSelectedItem", aCountry);
       }                 
              
       bResult = false; 
       break;              
  }

  return bResult;
}

main();

 

 

0
by Harry Ratia Author
Posted on Tue, 11/29/2011 - 14:29

Hi Vladimir,

 

Great, this is doing what I want it to do! Thanks a lot :-)

 

With regards   / Harry

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock