Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderator: amosbatto

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
#814886
First of all, do you know PHP and JavaScript? If not, go hire a programmer to help you.

It would be much easier if your users would export their Excel files as CSV files and then upload them to ProcessMaker, because no extra libraries will be needed to read the file. If you must have an Excel file, then follow these instructions to install PHPExcel on your ProcessMaker server. Also study the code example to learn how to use PHPExcel.

Then, create a MultipleFile field in your DynaForm to upload the Excel file.

Then, add a trigger to your process to open the Excel file and extract the information that you want and set its contents in a case variable named "excelContents".

You will need to query the APP_DOCUMENT table like this:
Code: Select all
$fileVarName = "uploadExcelFile";  //set to the variable name of your MultipleFile field.
$caseId = @@APPLICATION;
//get last uploaded document to the MultipleFile field:
$sql = "SELECT * FROM APP_DOCUMENT 
   WHERE APP_UID='$caseId' AND APP_DOC_FIELDNAME='$fileVarName' AND 
   APP_DOC_STATUS='ACTIVE' ORDER BY APP_DOC_CREATE_DATE DESC";
$aFiles = executeQuery($sql);
@=excelContents = array();

if (!empty($aFiles)) {
     $fileId = $aFiles[1]['APP_DOC_UID'];
     $version =  $aFiles[1]['DOC_VERSION'];
     //add your code here to use PHPExcel to open the file and extract the information
     //and save it to @=excelContents
}
Then, in your DynaForm, add JavaScript to call the POST cases/{app_uid}/execute-trigger/{tri_uid} endpoint to execute the above trigger and then call the GET cases/{app_uid}/variables endpoint to retrieve the "excelContents" variable.

See this JavaScript example:
viewtopic.php?t=713486#p795059
And see the documentation for Files and Input Documents to learn how ProcessMaker stores files.

【Q/微信729926040】如以删除请点网页快照,专业办理德国/法国/英国/加拿大各大学高端精仿文[…]

【Q/微信729926040】如以删除请点网页快照,专业办理德国/法国/英国/加拿大各大学高端精仿文[…]

【Q/微信729926040】如以删除请点网页快照,专业办理德国/法国/英国/加拿大各大学高端精仿文[…]

【Q/微信729926040】如以删除请点网页快照,专业办理德国/法国/英国/加拿大各大学高端精仿文[…]