Scenario 4: Performing Ingestion of Multiple Files with Single Transaction Form
- Last UpdatedJan 21, 2025
- 4 minute read
This scenario shows how you can create a form with multiple Tabs having PanelForm container containing a Grid control and use it in the workflow which uses single transaction for performing ingestion of multiple files with single/multiple Ingestion Activity.
Requirements
To perform ingestion of Customer, Order, and Invoice details in Single Transaction.
Designing a Form with three Tabs, each Tab containing a PanelForm container, each PanelForm containing a Grid control. Then using the Form API skelta.grid.saveGridDataToCloudStorage to upload the Grid Data to Aveva Cloud Storage and utilizing the returned filename in a Workflow with Ingestion Activity. Workflow is designed with single/multiple Ingestion Activity, which uses a single transaction.
Note : The uploaded file name should be 87 characters long (120 - 33 = 87) for Ingestion. If the file name contains special characters or spaces, each of these would count as three characters. Therefore, it is advisable to keep file names short when uploading them to AVEVA Drive.
To design a Form to perform ingestion of multiple files with single transaction
-
Create a Form and name it as FormForMultipleFilesIngestion.
-
Set the property Show Save Button as No for the Form.
-
Drag a Tab container into the Form.
-
In the Tab container, have three Tab controls and name it as CustomerDetails, OrderDetails, and InvoiceDetails respectively.
-
Inside each of the three Tab controls (CustomerDetails, OrderDetails, and InvoiceDetails), drag a PanelForm container and name it as PanelForm1, PanelForm2, and PanelForm3 respectively. For each PanelForm container set the property Show Panel Details as No.
-
Inside each of the three PanelForm containers (PanelForm1, PanelForm2, and PanelForm3), drag the following controls:
-
TextBox controls and name it as Source1, Source2, and Source3 for each container respectively. For more information on configuring TextBox control, refer to Text topic.
-
DataGrid controls and name it as CustomerDetailsGrid, OrderDetailsGrid, and InvoiceDetailsGrid for each container respectively. Configure each of the DataGrid controls and set the property Export All Pages to Yes. For more information on configuring DataGrid control, refer to Data Grid topic.
-
TextBox controls and name it as ExportedFileName1, ExportedFileName2, and ExportedFileName3 for each container respectively. For more information on configuring TextBox control, refer to Text topic.
-
-
Drag a Button control into the Form and name it as Process.

On Click script for the Process button
On Click script for the Process button uses skelta.grid.saveGridDataToCloudStorage() API to extract the data from the Grid, upload it to the AVEVA Cloud Storage, and submits the form, which invokes the associated workflow.
The On Click script is as given below:
var sources=[{"gridObject":control.findByXmlNode("CustomerDetailsGrid"), "fileName":"CustDet.XlSx"},
{"gridObject":control.findByXmlNode("OrderDetailsGrid"), "fileName":"OrderDet.xlsx"},
{"gridObject":control.findByXmlNode("InvoiceDetailsGrid"), "fileName":"InvoiceDet.xlsx"},
];
var targetControl=[control.findByXmlNode("ExportedFileName1"),
control.findByXmlNode("ExportedFileName2"),
control.findByXmlNode("ExportedFileName3")];
var ignoreEmptyGridDataValidation = false;
SFU.showLoader();
skelta.grid.saveGridDataToCloudStorage(sources, ignoreEmptyGridDataValidation)
.then(function(results){
var errorMessages="";
$.each(results,function(index,item)
{
if(SFU.isUndefined(item.fileName) || item.fileName=="")
{
if(!SFU.isUndefined(item.error))
{
if(errorMessages.length>0)
{
errorMessages += "<br>";
}
errorMessages += item.error.replaceString("\n","<br>");
}
else
{
targetControl[index].value= "";
}
}
else
{
targetControl[index].value=item.fileName;
}
});
if(errorMessages.length>0)
{
SFU.hideLoader();
SFU.showError(document.title, errorMessages);
}
else
{
control.submitForm(event);
}
});
Note: If the above needs to be achieved via Invoke Workflow rather than a Form submit, then we can use the above script in the Invoke Workflow control's Pre-Workflow Execution script using a promise object as below:
// Declare the promise object
var promiseObj = $.Deferred();
// The Form API call for saving grid data to cloud storage
var sources=[{"gridObject":control.findByXmlNode("CustomerDetailsGrid"), "fileName":"CustDet.XlSx"},
{"gridObject":control.findByXmlNode("OrderDetailsGrid"), "fileName":"OrderDet.xlsx"},
{"gridObject":control.findByXmlNode("InvoiceDetailsGrid"), "fileName":"InvoiceDet.xlsx"},
];
var targetControl=[control.findByXmlNode("ExportedFileName1"),
control.findByXmlNode("ExportedFileName2"),
control.findByXmlNode("ExportedFileName3")];
var ignoreEmptyGridDataValidation = false;
skelta.grid.saveGridDataToCloudStorage(sources, ignoreEmptyGridDataValidation)
.then(function(results){
var errorMessages="";
$.each(results,function(index,item)
{
if(SFU.isUndefined(item.fileName) || item.fileName=="")
{
if(!SFU.isUndefined(item.error))
{
if(errorMessages.length>0)
{
errorMessages += "<br>";
}
errorMessages += item.error.replaceString("\n","<br>");
}
else
{
targetControl[index].value= "";
}
}
else
{
targetControl[index].value=item.fileName;
}
});
if(errorMessages.length>0)
{
SFU.showError(document.title, errorMessages);
// Below statement would tell the process to not invoke the workflow
promiseObj.resolve(false);
}
else
{
// Below statement would tell the process to invoke the workflow
promiseObj.resolve();
}
});
// return the promise object
return promiseObj;
-
Publish the Form.
-
Go to the Forms List and select Associate from the context menu for the above form.
-
In the Form Binding screen, select Design a new workflow and click Next button.
-
Enter the Title for the Workflow as ScenarioForMultipleFilesIngestionWF in the New Workflow screen.
-
Click Save & Continue button. On success message screen, click Ok button.
-
On Workflow Tasks screen, select Design the Workflow now option and click Finish button.
The Process Designer screen opens to design the workflow.
You can design the workflow to perform ingestion for multiple files with maintaining single transaction in below two ways:
Note: If there are multiple Ingestion Activities serially in the workflow, then for the
first Ingestion Activity, the Transaction Id property value should be empty and the Complete Transaction property value should be false. For the next Ingestion Activities, the Transaction Id property value should be set with the Variable "^" + ActionName of First Activity + "TransactionId" and the Complete Transaction property value should be false, except the last Ingestion Activity where Complete Transaction property value should be true.
If you want to perform Ingestion Activity for Multiple Files with a Single Transaction,
then in the workflow, Ingestion Activity must be in serial.