Hello Community, I have encountered a problem by generation of the report. I have built a dialog box to let the user choose short or long version of report and then the report will be generated according to the version requirement. However, my report can not be generated every time after the dialog box jumps out. If I delete the dialog box there won't be any problem. Does anyone encounter the similar problem? Besides, I would also want to know if it's possible to build a dialog box without ok and cancel button? Thank you very much!
Here are the code to call the dialog and the generation of the report
function main() {
//Read active Databasename
//Dialogs.MsgBox(g_mmodellist);
var ofilter = ArisData.getActiveDatabase().ActiveFilter();
//Dialogs.MsgBox(ofilter)
g_nloc = Context.getSelectedLanguage();
//selectedModelsStringList = ArisData.getSelectedModels();
readActiveDatabaseName();
getprofilesfromconfig();
//Show the dialog
try {
report_mask();
}
catch(err) {
//tselectedprofile.sname = "SFS_2";
}
//Test-
readconfigfile();
//readmodels()
/* if (version == "short"){
for (i=0;i<selectedModelsStringList.length;i++){
Dialogs.MsgBox("Choose short");
model = selectedModelsStringList[i];
for each (var lang in ArisData.getActiveDatabase().LanguageList()) {
executeReport(tselectedprofile.sreportguidshort, model, model.GUID()+"_"+lang.LocaleInfo().getLocale()+"_"+model.Attribute(AT_VERSION, -1).getValue()+"_"+model.Attribute(Constants.AT_NAME, lang.LocaleId()).getValue()+".pdf", Constants.OutputPDF, lang.LocaleId())
} }
}*/
if (version =="short"){
Dialogs.MsgBox("Test1");
for each (var model in ArisData.getSelectedModels() ) {
for each (var lang in ArisData.getActiveDatabase().LanguageList()) {
if (lang.isDefault()){
var GUID_number = tselectedprofile.sreportguidshort;
Dialogs.MsgBox("Test2");
executeReport(GUID_number, model, model.GUID()+"_"+lang.LocaleInfo().getLocale()+"_"+model.Attribute(AT_VERSION, -1).getValue()+"_"+model.Attribute(Constants.AT_NAME, lang.LocaleId()).getValue()+".pdf", Constants.OutputPDF, lang.LocaleId())
Dialogs.MsgBox("Test3");
}}
}
}
if (version =="long"){
executeReportAttributeWithGUID(reportGUIDAttTypeNum, model, reportName, outputFormat, lang)
}
}
Setting of my dialog box
function report_mask()
{
var lreturn = 0;
var userdialog = Dialogs.createNewDialogTemplate(500, 200, "option box", "select_properties");
userdialog.GroupBox(100, 50, 300, 100, "Version", "GroupBox");
userdialog.PushButton(120, 100, 100, 20, "short","0_short");
userdialog.PushButton(260, 100, 100, 20, "long","0_long");
var dlg = Dialogs.createUserDialog(userdialog);
lreturn = __toLong(Dialogs.show( __currentDialog = dlg));
if (lreturn != -1) {
Context.setScriptError(Constants.ERR_CANCEL);
return;
}
}
function select_properties(dlgitem, action, suppvalue) {
var __functionResult = false;
var lselectedprofile = 0;
switch(action) {
case 1:
tselectedprofile = g_sprofiles[0];
break;
case 2:
if (dlgitem == "0_short") {
version = "short"
// __functionResult = true;
}else if(dlgitem == "0_long"){
version = "long"
//__functionResult = true;
}
break;
case 3:
break;
case 4:
break;
case 5:
rem(select_properties == true);
// Leerlaufaktionen einholen fortfahren
break;
case 6:
break;
}
return __functionResult;
}
Seeing this way of building a dialog, I'm glad I only started with dialogs with the new dialog method ("Dialogs.showDialog(...)"). If you are using an ARIS version capable of the new dialog method, maybe you could re-create your dialog with the new method? The methods you use are deprecated in my version of ARIS (10 SR3), maybe in yours too? Maybe that's what is causing the problem? The new method to build dialogs is more structured, with clear lifecycle phases of the dialog.
Take a look at the script documentation (from your ARIS Architect click the question mark in the top right corner, on the following website select "ARIS Script"). There in the left panel ("Contents") you want to select "ARIS Script" > "Methods for reports and semantic checks" > "Global objects" > "Dialogs object" > "DialogObject"). This should bring up an example script in the right panel for how to build and display a dialog with the new method.
Detached from whether or not you can use the new method, have you tried debugging your script? It would be interesting to see the value of the variable "version" when you make the decision between the short and the long version. This would allow you to differentiate between an error in your follow-up scripts, or in the dialog.