YS
Hello.

Please tell me how can I return information about choosing one of the optionButtons. For example, write 1 to a variable if the first optionButton is selected, or write 2 to this variable if the second optionButton is selected? To then return this variable to the main function. Buttons can be used instead of optionButtons, but the question remains the same.
by Kay Fischbach
Posted on Wed, 01/23/2019 - 13:35
 function myDialog()
 {
     this.switchVariable = 1;

     this.getPages = function()
     {
         var iDialogTemplate1 = Dialogs.createNewDialogTemplate(600, 200, "Only page");
         iDialogTemplate1.OptionGroup("OG_1");
         iDialogTemplate1.OptionButton(35, 5, 80, 15, "Press 1")
         iDialogTemplate1.OptionButton(35, 25, 80, 15, "Press 2")
         return [iDialogTemplate1];
     }

     this.getResult = function()
     {
         return this.switchVariable;
     }
    
     this.OG_1_selChanged = function(indexOfNewSelection){
         this.switchVariable = indexOfNewSelection + 1;
     }
    
 }
 
 var result = Dialogs.showDialog(new myDialog(), Constants.DIALOG_TYPE_ACTION, "A dialog");
 Dialogs.MsgBox(result)

 

Basically what you want to do is add a variable to your Dialog object with "this.WhateverItIsSupposedToBeCalled = 0", then add a method that is called whenever the selection within your option group is changed. The name of this method has to start with the field name of the option group, then you append "_selChanged" (without quotation marks). If the method is not named like this, it won't be called when the selection changes. This reaction method should change the previously added variable. To return the value of the variable, use the this.getResult function.

Doing the same with normal buttons, instead of an option group requires two reaction methods instead of one reaction method. Each button has to have its own reaction method, with the following name sceme: start with the field name of the individual button, append "_pressed" (without quotation marks) to that. The method then switches the variable to the desired value. To return the variable after normal buttons are pressed, use the same this.getResult function you would have used with the option group.

 

Edit: made a tiny mistake within my script (initialized the switchVariable with 0 instead of 1). Corrected it.

0
by Yuriy Stolyarov Author
Posted on Thu, 01/24/2019 - 07:02
Hello, Kay! Thank you very much. Your answer is very helpful for me. I already launched it and tested it. Now I have new ideas for development - with the help of this I will combine similar scripts.
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