Dear Community, I need help and advise regarding the following:
- I have a database whose structure is as follows
- An example of an EPC Model in the Db is
Process Name | Sub-process Name | Person Type | Application System Type | Screen |
Process 1 | EPC_1 | Person Type A | ||
Person Type B | ||||
Person Type C | X | S 1 | ||
Person Type D | Y | S 2 | ||
EPC_2 | Person Type E | Z | S 3 | |
Person Type A Person Type F | M | S 4 | ||
Process 2 | EPC_6 | Person Type G Person Type C | N | S 5 |
Hi Again, I tried the above and the end result is still not as expected. I exported the extraction into MS Excel, unfortunately the information is being displayed on several Excel sheets and the displayed information is not coherent at all. Below are the results and my report for the appended EPC model: I have the following in my report design: · A query of all the EPC models in the selected group · A query for all Application System Types in the selected EPC model · A query for all Person Types in the selected EPC model. Thank you beforehand for any advise or help. Best regards Shameem
hi Shameem,I have designed a sample report according to your description.The code is as follows:
//var
var gi_LocaleId = Context.getSelectedLanguage(); //语言
var gs_OutFileName = Context.getScriptInfo(Constants.SCRIPT_NAME)+ ".xls"; //输出报表的文件名
var gs_HeadList = new Array("Process Name","Sub-process Name","Person Tpye","Application System Type","Screen");//表头
var gi_WidthList = new Array(18,30,18,30,24);//列宽
var go_OutFile = null;
//主函数
function main()
{
var go_SelectedGroupList = ArisData.getSelectedGroups(); //选定运行的组
var go_SelectedSubgroupList = go_SelectedGroupList[0].Childs(false);
go_SelectedSubgroupList = go_SelectedSubgroupList.sort(sortName);
//Dialogs.MsgBox(go_SelectedSubgroupList.length);
go_OutFile = uf_InitOutFile(go_OutFile,gs_OutFileName,gi_LocaleId);
go_OutFile.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0);
go_OutFile.TableRow();
for(var i=0; i<gs_HeadList.length; i++)
go_OutFile.TableCellF(gs_HeadList[i], gi_WidthList[i], "TABLE_HEAD");
for(var j=0;j<go_SelectedSubgroupList.length;j++)
{
var ls_ProcessName = go_SelectedSubgroupList[j].Name(gi_LocaleId);
var lm_ModelsEPC = go_SelectedSubgroupList[j].ModelList ( );
lm_ModelsEPC =lm_ModelsEPC.sort(sortName);
for(var k=0;k<lm_ModelsEPC.length;k++)
{
var lo_FunctionOccs = lm_ModelsEPC[k].ObjOccListFilter ( -1, Constants.ST_FUNC );
var ls_Sub_ProcessName = lm_ModelsEPC[k].Name(gi_LocaleId);
if(lo_FunctionOccs.length==0)
{
go_OutFile.TableRow();
go_OutFile.TableCellF(ls_ProcessName, 10, "TEXT");
go_OutFile.TableCellF(ls_Sub_ProcessName, 10, "TEXT");
go_OutFile.TableCellF("", 10, "TEXT");
go_OutFile.TableCellF("", 10, "TEXT");
go_OutFile.TableCellF("", 10, "TEXT");
}
//Dialogs.MsgBox(lo_FunctionOccs.length);
for(var m=0;m<lo_FunctionOccs.length;m++)
{
var lo_PersonTypeOcc =lo_FunctionOccs[m].getConnectedObjOccs ( Constants.ST_EMPL_TYPE );
var lo_SystemOcc =lo_FunctionOccs[m].getConnectedObjOccs ( 65569 );
var lo_ScreenOcc =lo_FunctionOccs[m].getConnectedObjOccs ( 16 );
go_OutFile.TableRow();
go_OutFile.TableCellF(ls_ProcessName, 10, "TEXT");
go_OutFile.TableCellF(ls_Sub_ProcessName, 10, "TEXT");
if(lo_PersonTypeOcc.length>0)
go_OutFile.TableCellF(lo_PersonTypeOcc[0].ObjDef ( ).Name(gi_LocaleId), 10, "TEXT");
else
go_OutFile.TableCellF("", 10, "TEXT")
if(lo_SystemOcc.length>0)
go_OutFile.TableCellF(lo_SystemOcc[0].ObjDef ( ).Name(gi_LocaleId), 10, "TEXT");
else
go_OutFile.TableCellF("", 10, "TEXT")
if( lo_ScreenOcc.length>0)
go_OutFile.TableCellF( lo_ScreenOcc[0].ObjDef ( ).Name(gi_LocaleId), 10, "TEXT");
else
go_OutFile.TableCellF("", 10, "TEXT")
}
}
}
go_OutFile.EndTable("DD", 100, "", 0, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT, 0);
go_OutFile.WriteReport();
Dialogs.MsgBox("The file has been output!");
}
main();
// 排序用到的函数,基于对象的“表示符”大小
function sortName(a, b)
{
return a.Name(gi_LocaleId)>b.Name(gi_LocaleId);
}
Hi Mr John,
I copied the code into ARIS but unfortunately i'm having an error message:
As I am not a professional programmer , I asked for help around with colleagues who are more at ease with Java script, but we could not find our way out.
Thank you again for your valuable help
Cheers
Shameem
oh,i forgot adding the definition of the"uf_InitOutFile".You can add the following code behind the report.
function uf_InitOutFile(ao_outfile,as_outfileName,ai_LocaleId)
{
ao_outfile = Context.createOutputObject(Context.getSelectedFormat(), as_outfileName);
ao_outfile.Init(ai_LocaleId);
ao_outfile.DefineF("TABLE_HEAD","Arial", 15, Constants.C_BLACK,Constants.C_GREY_80_PERCENT, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VCENTER, 0, 0, 0, 0, 0, 1);
ao_outfile.DefineF("TEXT","Arial",10,Constants.C_BLACK,Constants.C_TRANSPARENT, Constants.FMT_LEFT | Constants.FMT_VCENTER, 10, 0, 0, 0, 0, 1);
return ao_outfile;
}
PS: This report is designed according to your first description.Its funtion is limited. U shoud run it base on the group of "main group". My MSN is rnhmn@hotmail.com
Hi John,
I tried to use this script and specificaly created the same structure as used by Shameen, but I get an error. The program says that the file has been output and then tells me "Error while executing script: Script: line -1". I have tried to debugg and it seems that the code has an error with defining the ao_outfile.DefineF in the uf_InitOutFile function.
Please advise what the problem might be as I am also trying to create a similar report to the above.
Regards,
Vlad