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;
}