Context Information

The Context Information object in Astera Centerprise provides a set of context information parameters that take their values at runtime of a dataflow or workflow. These parameters include several details related to the job taking place and the server on which it is being run, such as ServerName, JobId, UserName, and DroppedFilePath, among others.

Use Case

In this use case, we will automate the process of writing a fictitious organization’s customer data, which is currently available in an Excel format, to a database table. The source data is stored in multiple Excel files, and each of these files will be dropped into a particular folder. Our goal is to design a process where customer data is extracted from every file that is dropped into the folder, and then written to a destination table without any manual intervention. For this, we will be using the DroppedFilePath parameter in the Context Information object, in conjunction with the When File is Dropped option in the Centerprise Job Scheduler.

Using the Context Information Object in Astera Centerprise

We have already designed a dataflow to create the process of writing data to a destination table, and we will orchestrate this process for automation in a workflow.

01-context-information-dataflow

In the dataflow, we have used an Excel Workbook Source object to extract data from the source files, and a Database Table Destination object to write this data to a database table. A Variables object has been used to create a variable that will provide source file paths to the Excel Workbook Source object.

On the Variables Properties screen of the Variables object, you will see that we have created an input variable, FilePath.

02-context-information-variable-filepath

We have used this variable as an input parameter for the FilePath section in the Config Parameters screen of the Excel Workbook Source object.

03-context-information-excel-config-parameters

We have incorporated this dataflow into our workflow by using the Run Dataflow object. You will notice that the FilePath variable is visible in the object layout.

04-context-information-run-dataflow

Go to the Resources section in the Toolbox, and drag-and-drop the Context Information object onto the workflow designer.

05-context-information-workflow

In the object layout, you can see all of the context information parameters that are available. If you wish to see their data types, right-click on the object header and select Properties from the context menu.

06-context-information-properties

Name: Name of the workflow. For example, Workflow1.wf

JobId: ID of the job assigned by the server

ScheduledJobId: ID of the job associated with a schedule in case of scheduled running on a server

ServerName: Name of the server running the workflow

UserName: User account that runs the workflow

DroppedFilePath: Path to the file being dropped, in case of a scheduled job of type ‘When File is Dropped’

As mentioned earlier, all of these parameters take their values at run-time.

In this case, we require the DroppedFilePath parameter’s value to be fed to the source object in our dataflow. Map this parameter from the Context Information object to the FilePath variable that is visible under the Input node of the Run Dataflow object.

07-context-information-worflow

Now, all that is left is to schedule this job to run whenever a source file is dropped into a specified folder. For this, we have selected the When File is Dropped option under the Frequency section of the Job Scheduler.

08-context-information-job-scheduler

Further, we have specified a directory where the files will be dropped.

09-context-info-job-scheduler-file-drop

Once we have created this schedule, every delimited file dropped into this folder will automatically be written to the destination table. Here is a look at the destination table after we have added one source file to the folder.

10-context-information-destination-table

This concludes using the Context Information object in Astera Centerprise.