printTable() with mapping options gives errors

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
4 posts • Page 1 of 1
erik.schwing
Posts:16
Joined: Tue Feb 12, 2019 6:59 am

printTable() with mapping options gives errors

Post by erik.schwing »

Hello,

I am trying to use the function printTable() to print a table to a PDF file.
I am using the mapping options that looks as follows:

Code: Select all

mapping mOptions = makeMapping();
  mOptions["showDialog"] = bPrint;
  mOptions["header"] = makeDynString();
  mOptions["footer"] = makeDynString("\\right{\\page | \\numpages");
  mOptions["columnsType"] = PT_INDEXEDCOLUMNS;
  mOptions["columns"] = makeDynInt(2,3,4,5,6,7,8,9,10,11);
  mOptions["fitToWidth"] = bFitToPage;
  mOptions["printerName"] = (bPrint) ? "" : "file:///" + strFile;
  mOptions["font"] = strFont;
  mOptions["useColor"] = (int)bKleur; // 0 = no color used, 1 = cell color

  int iResult = printTable(sTable, mOptions);
  
the options "header", "footer", and "columns" result in errors and warnings no matter what i do. Only by removing the option completly from the mapping it works. Below is an example of the logviewer when the options "header" and "footer" have been removed.

Code: Select all

WCCOAui      (1), 2021.12.16 10:04:46.890, CTRL, SEVERE,      5/ctrl, Location of the following log entry: 
    Module: Vision_3
    Panel: D:\project_source\LBSLIB\LBSLIB\LBSlibOA\panels\08_Historie\3B_Logging_Export.xml [3B Logging export]
    Object: 12 named: "KNOP_Exporteren" of type: PUSH_BUTTON
    Script: Clicked
    Library: D:\project_source\LBSLIB\LBSLIB\LBSlibOA\scripts\libs\lbs_Logging.ctl
    Line: 1009
WCCOAui      (1), 2021.12.16 10:04:46.890, PARAM,SEVERE,     51, Parameter incorrect, 
    Module: Vision_3
    Panel: D:\project_source\LBSLIB\LBSLIB\LBSlibOA\panels\08_Historie\3B_Logging_Export.xml [3B Logging export]
    Object: 12 named: "KNOP_Exporteren" of type: PUSH_BUTTON
    Script: Clicked
    Library: D:\project_source\LBSLIB\LBSLIB\LBSlibOA\scripts\libs\lbs_Logging.ctl
    Line: 1009, printTable, columnDefinition: index out of range: 111115696
WCCOAui1:[mapping 7 items
WCCOAui1:   "columnsType" : 3
WCCOAui1:   "useColor" : 1
WCCOAui1:   "columns" : dyn_int 10 items
WCCOAui1:	     1: 2
WCCOAui1:	     2: 3
WCCOAui1:	     3: 4
WCCOAui1:	     4: 5
WCCOAui1:	     5: 6
WCCOAui1:	     6: 7
WCCOAui1:	     7: 8
WCCOAui1:	     8: 9
WCCOAui1:	     9: 10
WCCOAui1:	    10: 11
WCCOAui1:   "printerName" : "file:///D:/project_source/LBSLIB/LBSLIB/LBSlibOA/data/export/3B_Export_20211216.pdf"
WCCOAui1:   "font" : "Arial,-1,15,5,50,0,0,0,0,0,Regular"
WCCOAui1:   "showDialog" : FALSE
WCCOAui1:   "fitToWidth" : TRUE
WCCOAui1:]
WCCOAui1:[0]
Does anyone have an idea why the colum index "111115696" is being looked for? Could this be an error code return message somewhere?

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: printTable() with mapping options gives errors

Post by kilianvp »

you forgot a curly bracket at the end to close right

Code: Select all

mOptions["footer"] = makeDynString("\\right{\\page | \\numpages}");

erik.schwing
Posts:16
Joined: Tue Feb 12, 2019 6:59 am

Re: printTable() with mapping options gives errors

Post by erik.schwing »

i fixed the bracket but still get the same results.

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: printTable() with mapping options gives errors

Post by kilianvp »

Here are an working example that should work as well in 3.18:

Code: Select all

  dyn_string header;
  dyn_string footer = makeDynString("\\right{\\page | \\numpages}");
  string  shapeName = "TABLE1";
  bool    showDialog = false;
  int     columnsType=PT_INDEXEDCOLUMNS;
  dyn_int columns=makeDynInt(2,3,4,5,6,7,8,9,10,11);
  bool    fitToPage=true;
  bool    landscape=true;
  bool    gridLines=true;
  bool    gridBackground=true;
  dyn_int margin=makeDynInt( 20,20,20,20 );
  string sTime = formatTime("_%Y%m%d_%H%M%S", getCurrentTime());
  string reportFolder = PROJ_PATH + "data";
  string  printerName = "file:///" + reportFolder + "/Table"+ sTime + ".pdf";
  printTable( shapeName,
                showDialog,
                header,
                footer,
                columnsType,
                columns,
                fitToPage,
                landscape,
                gridLines,
                gridBackground,
                margin,
                printerName );
Mapping isn't working. It think you found a WinCC OA Bug. You should report this to the Siemens Support.

4 posts • Page 1 of 1