Posted: 5 Mar 2019 23:37 EST Last activity: 13 Mar 2019 23:04 EDT
Virtual Data Table after Interaction starts
I was going through this point
"Once the interaction starts, a virtual data table creates a structure column to represent each context value. Every interaction started receives a new row in the data table. The data table also has an interaction key column. When an automation closes an interaction in the framework, the framework deletes the data row and values of the interaction."
For example my Context Values in Interaction XML are as below
After interaction starts how will the datatable look like. Please help me understand.
i think all the context variables should be available for us after interaction starts so that we can assign values to those that are needed and share them across. how come "Every interaction started receives a new row in the data table." makes sense.
To get to the DataTable, you can call the GetTable method of the InteractionManager component. The preferred way for interacting with the table though (to get and set values) is to simply refer to the interaction values exposed in the InteractionManager component. Once you connect the component up in your automation, it will prompt you via a key fitting to provide the interaction key. Once you supply a key, you may get or set the values for that interaction.
The GetTable method of the InteractionManager component shows the activities currently in-queue. Since you have none, it is blank. It does not provide access to the individual data stored in each interaction. Access to that is provided via the component properties (such as ClientFullName, Address1, etc...) that you can drag onto your automation surface.
You should use a Key of None for the GetTable method. In addition, it will only ever show one item in queue in your example, however it will be very tough to catch because both activities are virtually instantaneous. The GetTable method is just going to return the activity queue and will not contain running activities. To see anything try using my example. I altered it to protect the windows thread as any updates to a DataSource on a DataGridView must be made on the form thread.
All updates to a datasource bound to a DataGridView must be made on the windows form thread (this is a .Net requirement). If we bind the DataTable from GetTable to the DataGridView directly, then as it is updated (by the activity thread), it will cause the DataGridView to freeze (since the table is being updated by the activity thread). I made a copy of the DataTable to separate it from the underlying table. I then called PerformClick on a button that is "visible" (it is behind something else, but it is not hidden). The Click event from this button will be on the form thread. I can then bind the copy of the table to the DataGridView as it won't be updated by anything else.
I always make AllProjectsStarted asynch as this will turn off the SplashScreen. I made the ActivityCompleted asynch before I called TerminateRuntime so that Runtime could shut down. The activity thread would still be running if it were synchronous and was preventing the shutdown. Generally, you would never make the ActivityCompleted event asynch as that would allow the next activity in-queue to proceed.