JC

 

Hi,

Can someone help me please?

I am trying to do a dialog with a textbox where I will type a text, and i would like to get that text and put in "setValue(text)" to set value of the attribute, I had found one script and I've used some parts but it appear error in line 65 "__toString(dlg.getDlgText("Text0"))". How can I get the text from the textbox and insert it in the var inside the "setValue()"?

// --------------------------------------------------------
// Script para mudar valores de Atributos não editáveis
// modelos e objetos de um certo grupo
// 
// --------------------------------------------------------
 
function main()
{
  var sname = new __holder("");
 
  userdlg();
    
  var ogroups = undefined;   var oattribute = undefined;   var ocurrentmodel = undefined;   var ocurrentobjdef = undefined;   var omodels = undefined;   var oobjects = undefined;   var ogroup = null; 
  var i = undefined;   var j = undefined;   var numberofobjects = 0;
  var atributo =  0;
  var atributo2 =  0;
  
  var g_nLoc = Context.getSelectedLanguage();
  ogroups = ArisData.getActiveDatabase().GroupList(ArisData.getSelectedGroups()[0]);
   
  for ( i = 0 ; i < ogroups.length; i++ ){
    ogroup = ogroups[i];
    omodels = ogroup.ModelList(true);
 
    for ( j = 0 ; j < omodels.length; j++ ){
      ocurrentmodel = omodels[j];
      var creator = ocurrentmodel.Attribute(Constants.AT_CREATOR,g_nLoc);
      creator.setValue(sname);
    }
 
    omodels = null;
 
    oobjects = ogroup.ObjDefList();
    for ( j = 0 ; j < oobjects.length; j++ ){
      ocurrentobjdef = oobjects[j];
      var creator = ocurrentobjdef.Attribute(Constants.AT_CREATOR,g_nLoc);
      creator.setValue(sname);
    }
    oobjects = null;
  }
   
  ogroups = null;
}
 
function userdlg()
{
  var nuserdlg = 0;   // Variable for the user dialog box
  //var sattrstr = __createArray("");   // List of strings of selectable attributes.
   
  var userdialog = Dialogs.createNewDialogTemplate(0, 0, 300, 200, "Troca de Valores");
     
  userdialog.Text(20, 100, 460, 20, "Digite o novo valor para troca");
  userdialog.TextBox(20, 130, 530, 20, "Text0", 0);
  userdialog.OKButton();
  userdialog.CancelButton();
 // userdialog.HelpButton("HID_c8746560_2f2f_11d9_017b_e10284184242_dlg_01.hlp");
 
  var dlg = Dialogs.createUserDialog(userdialog); 
  var sSection = "Process_Office/348b7ef0-944f-11e1-5844-00505637013f";  
   
  ReadSettingsDlgValue(dlg, sSection, "Text0", 1);
  nuserdlg = Dialogs.show(dlg);
  // Showing dialog and waiting for confirmation with OK
  if (nuserdlg != 0){
      sname = __toString(dlg.getDlgText("Text0"));
     
    // Write dialog settings to config 
    WriteSettingsDlgValue(dlg, sSection, "Text0");
  }
  return (nuserdlg != 0)
}
main();

Regards,

Jack

by Ilya Seletkov
Posted on Sat, 05/12/2012 - 06:15

Hello!

To read user's text fields from dialogs I use next code:

//Dialog template
var oTmplMain = Dialogs.createNewDialogTemplate(0,0,"DialogName");
//Text field
oTmplMain.TextBox(20,20,50,14, "txRelease");
//Create dialog's window by template
var oDlgMain = Dialogs.createUserDialog(oTmplMain);
//Set predefined value of the text field
oDlgMain.setDlgText("txRelease", "46C");
//Show the window of dialog
if(Dialogs.show(oDlgMain) != -1)
        return; 
//Get text value from the text field
var sText = oDlgMain.getDlgText("txRelease");

//Set attr value
oObjDef.Attribute(Constants.AT_NAME, -1).setValue(sText);

Hope, this helps.

 

0
by Vinay Agarkhed
Posted on Mon, 05/14/2012 - 06:07

Hi Jack,

What is the error you are getting at that line ?

Have you using the imported files for this script? If not it might be the cause of the error you are getting on particular line.

If so do this, in script editor open the script right click and select properties, click on Imported files and select convertertools.js file.

Hope it will resolve the said issue.

 

Regards,

Vinay

 

0
by Jack Chung Author
Posted on Thu, 05/17/2012 - 17:19

Hi Vinay and IIya, thanks for helping.

I 've tried to get the value of the textbox but when the report was succefully runned, I had checked the attribute if the value was what I had inserted, but the attribute has the value something like this: [obj Object].

Maybe it is not getting the value of the dialog box.

What can I do?

Regards,

Jack.

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