I have a For Loop activity that iterates through an excel worksheet. I want to pass it ByRef as an argument to a sub workflow. I have tried various combinations of IN/OUT on both the parent & child workflows. I want to pass the current row to the sub workflow as a pointer and be able to make changes to it that change the original currentrow and the Excel worksheet. Please let me know what datatypes and in/out combos I need or other Activities to accomplish this. I may try to pass the index of the row and lookup up the excel row in the sub, but that seems like a lot of overhead.
Why not just pass the datatable into the Invoke as an in/out and do the loop inside the sub workflow?
@Phil_Kelsey Do you want to send DataRow in workflow but you do not want to change it right.
Hi @Phil_Kelsey
You can pass the currentrow data by storing in a variable and pass to the child workflow.
=> If you want to get the data from parent workflow to child workflow the argument direction is In.
=> If you want to send the data from child workflow to Parent workflow then the argument direction is in out.
=> If you want to send and receive the data from child to parent workflow then give the argument direction to In\Out.
Hope it helps!!
To Send in child from parent then use in.
To Send back to parent from child then use out.
To get updated data from child then use in/out
No, I want to change many of the cells in the child workflow
Have you tried just passing CurrentRow as an in/out?
I could, it seems like a lot of overhead. But can i pass the dataset in ByRef or is it going to be just a copy? In VB it would pass ByRef by default
@Phil_Kelsey its not overhead set argument type as in/out. it will update orignal table
It doesn’t matter. It’s an In/Out argument. The point to an In/Out argument is that it both sends the data in as an argument and passes it back out to update the parent workflow.
Anyway, if you just pass CurrentRow as an in/out argument of System.Data.DataRow, and update it in the sub workflow, it updates in the parent workflow. I just tested it.
I set up the display as you said. but I still get an error
I have a For Each activity. CurrentRow in excel.sheet(“sales”)
I have a ‘Invoke Workflow File’ activity the calls a sub workflow
Child (invoked workflow)
Parent (calling workflow)
Are you using a For Each or a For Each Row in Datatable?
What’s the argument datatype in the sub workflow?
“For Each Excel Row”
This all worked fine and correctly updated the Excel ss until i tried to incorporate the remote workflow using the “Invoke Workflow File” activity
Oh, that’s different. CurrentRow in For Each Excel Row is a different datatype than CurrentRow in For Each Row in Datatable. I suggest using Read Range to get it into a datatable, then use For Each Row. Then CurrentRow as an in/out will update the datatable as you expect. When you’re done you can Write Range back to Excel.