Performing Ingestion Using Single Ingestion Activity
- Last UpdatedJun 25, 2024
- 3 minute read
To perform ingestion using single Ingestion Activity
-
Declare the following Variables in the Start Activity:
-
VarPanelFormCount – number
-
VarFileNameArray – array
-
VarSourceArray – array
-
VarFileName – string
-
VarSource – string
-
VarCompleteTransaction – boolean
-
intLoopVariable – number
-
intTotalLoopCount – number
-
^MultipleFilesIngestionTransactionId – string
-
^MultipleFilesIngestionServiceResponse – string

-
-
Update the VarPanelFormCount Variable value through Initialize Variable(s) property in the Start Activity based on the number of panel forms in the designed form. In this example, the Form is designed with three PanelForms.

-
Drag a Script Activity after the Start Activity and name it as GetFileNameandSource.
-
Set the Language as CSharp.Net.
-
Enter the code text as below in the Code property.
using System;
using System.Collections;
using System.Xml;
using Workflow.NET;
using Workflow.NET.Engine;
public class WorkflowScript61092250167a4eb297eb3890bc7e3b6b
{
public string Run(int ExecutionId, int ExecutionDetailsId, Workflow.NET.Engine.Context ctx, Workflow.NET.Action action, string inlink)
{
XmlVariable xmlVar = ctx.XmlVariables["SFFormData"];
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlVar.RawXml);
var totalCnt = Convert.ToInt32(ctx.Variables["VarPanelFormCount"].Value);
ArrayList arrFileNames = new ArrayList();
ArrayList arrSourceNames = new ArrayList();
for (int i = 1; i <= totalCnt; i++)
{
var xPath = "Panelform" + i;
foreach (XmlNode nodes in xmlDoc.DocumentElement.SelectNodes("//SKRootDefinition/" + xPath))
{
var fileNameXmlNode = nodes.SelectSingleNode("ExportedFileName" + i);
var sourceXmlNode = nodes.SelectSingleNode("Source" + i);
if (!string.IsNullOrWhiteSpace(fileNameXmlNode.InnerText))
{
if (ctx.Variables["VarFileNameArray"].Value != null)
{
arrFileNames = (ArrayList)ctx.Variables["VarFileNameArray"].Value;
}
arrFileNames.Add(fileNameXmlNode.InnerText);
ctx.Variables["VarFileNameArray"].Value = arrFileNames;
if (ctx.Variables["VarSourceArray"].Value != null)
{
arrSourceNames = (ArrayList)ctx.Variables["VarSourceArray"].Value;
}
arrSourceNames.Add(sourceXmlNode.InnerText);
ctx.Variables["VarSourceArray"].Value = arrSourceNames;
ctx.SaveVariables();
}
}
}
ctx.Variables["intTotalLoopCount"].Value = arrFileNames.Count;
ctx.SaveVariables();
return "Success";
}
}
-
-
Drag the For Loop Activity from the Engine Activity and connect it from Script Activity named GetFileNameandSource.
-
Set the Loop Variable as intLoopVariable.
-
Set the Loop Count as intTotalLoopCount.

-
-
Drag a Script Activity and name it as AssignFileNameandSource.
-
Link the Script Activity from For Loop with the Output Step.
-
Set the Language for the Script Activity as CSharp.Net.
-
Set the Code as below in the Code property.
using System;
using System.Collections;
using Workflow.NET;
using Workflow.NET.Engine;
public class WorkflowScript226c5adbe4724df2bd7e719c6731c3ad
{
public string Run(int ExecutionId, int ExecutionDetailsId, Workflow.NET.Engine.Context ctx, Workflow.NET.Action action, string inlink)
{
var index = Convert.ToInt32(ctx.Variables["intLoopVariable"].Value) - 1;
var loopCount = Convert.ToInt32(ctx.Variables["intTotalLoopCount"].Value);
ArrayList arrFileNames = (ArrayList)ctx.Variables["VarFileNameArray"].Value;
ArrayList arrSourceNames = (ArrayList)ctx.Variables["VarSourceArray"].Value;
ctx.Variables["VarFileName"].Value = arrFileNames[index];
ctx.Variables["VarSource"].Value = arrSourceNames[index];
if ((index + 1) == loopCount)
{
ctx.Variables["VarCompleteTransaction"].Value = true;
}
else
{
ctx.Variables["VarCompleteTransaction"].Value = false;
}
ctx.SaveVariables();
return "Success";
}
} -
Set the return value as Success.
-
-
Drag a Ingestion Activity and name it as MultipleFilesIngestion.
-
Link the AssignFileNameandSource script activity to the Ingestion Activity with the output link as Success.
-
Set the FileName property value as <%#Variable.VarFileName%>
-
Set the Source property value as <%#Variable.VarSource%>
-
Set the Complete Transaction value through Expression Editor pointing to the variable VarCompleteTransaction.
-
-
-
Drag the Next Loop Activity from the Engine Activity category.
-
Link from the MultipleFilesIngestion Activity to the Next Loop Activity with the link output as Successful.
-
-
Link from the Next Loop Activity to the For Loop Activity with the link output as Next Step.
Design the Workflow as below:
