Answered

I don't understand the cause of the error

I want to read the lines of an Excel, the model process name and my data model name are both Excel

Exactly from the code of this link

https://help.bizagi.com/bpm-suite/fa/index.html?working_excel.htm

I use, but I do not know the cause of this error

please guide me.

// Obtain the file collection from the data model

var oFile =<Excel.MyFile>;

// Empty file validation

if(!oFile.size() > 0)

{

CHelper.ThrowValidationError("Please load a file");

}

// Obtain the first loaded file and its data

var oFileDef = oFile.get(0);

var oFileDataDef = oFileDef.getXPath("Data");

// Extract file content

var dtContenIn = CHelper.GetDataTableFromWorkSheet(oFileDataDef, 0);

// Obtain each record and add it to the Sales Data entity

for(var j=0; j < dtContenIn.Rows.Count; j++)

{

var oRecord = dtContenIn.Rows[j];

var newRecord = Me.newCollectionItem("Excel.Excel");

newRecord.setXPath("name",oRecord[0]);

newRecord.setXPath("family",oRecord[1]);

newRecord.setXPath("gender",oRecord[2]);

newRecord.setXPath("position",oRecord[3]);

newRecord.setXPath("salary",oRecord[4]);

}

Files: 1.PNG
Best Answer
photo

Dear Yousef,

The error is because in the example on our website the information will be uploaded to the Sales Data collection like this:

var newRecord = Me.newCollectionItem("UploadExcel.salesData");

In your case, you should change the xpath:

var newRecord = Me.newCollectionItem("Excel.salesData");

Best regards,

Comments (1)

photo
1

Dear Yousef,

The error is because in the example on our website the information will be uploaded to the Sales Data collection like this:

var newRecord = Me.newCollectionItem("UploadExcel.salesData");

In your case, you should change the xpath:

var newRecord = Me.newCollectionItem("Excel.salesData");

Best regards,