Can I have nested groups?
BeantwoordI have a list of sheets I need to iterate, and for each I need to determine if the file already exists. So I have a group of commands to check that, but for each result I need to perform a different group of operations. However the group iteration finishes first before moving on to the pass / fail branch. How do I nest one group inside another, or alternatively use branching depending on exit result of previous command inside a group?
-
Hi Waldo,
Groups can't be nested. Chains need to be architected in such a way that would not require nested Groups. You can have seperate Groups that iterate over the same list or even call sub-chains to run commonly used processes.
0But that severely restricts the usefulness of chains. I cannot seem to do any branching logic inside of a group. So if I want to iterate a list, with a set of commands grouped together, I cannot make any branching decisions on the outcome of any command in the group.
A simple scenario: Iterate list of sheets. For each sheet see if sheet file exists in Table. If it exists then unimport, delete and write new. If it does not exist write new. This is similar to your video example in the training university. However, since I am iterating over all sheets and not doing one file, I cannot use any branching logic. So how would I implement this? I cannot call a chain inside of a group either it seems - dropping a Run Chain command on the canvas does not allow me to add it to a group, so I cannot call a run chain iteratively with the rest of my commands.
0To achieve the sample scenario you mentioned, try this: First do a List Sheet command to get all sheet file names (assuming the files in Wdata Table are the same as spreadsheet sheet names). Then do a List Files command on the the Wdata Table to get all names of files in the table. These two commands can be grouped together and run in parallel.
In the next group of commands, iterate over the list of sheet names returned previously from the List Sheet command. Using 'Advanced Query', check if the file name exists in the list of files in the Wdata Table and attempt to extract it's 'fileId'. If it does exist, continue to un-import/delete the file so that the new file can be uploaded. If the file does not exist, the 'fileId' value will be empty and we can expect that the un-import/delete commands will report an error, but allow the Chain to continue. Next, process the new file by uploading and importing it. All of these steps can be in the same group of nodes iterating in serial.
On the un-import and delete nodes, a Skip condition could be added. For example, skip the node if 'fileId' is empty. The Chain result could be set to success at the end of the run knowing that failures on the un-import and delete node steps are expected when 'fileId' is empty.
0This is very similar to what I ended up doing yesterday, however supporting branching logic and success/failure/always flow between commands in a group would be really powerful. Is this something that Workiva is considering adding in the future?
Thank you for your help by the way.
0We are in the process of overhauling Groups. Groups will look a little different and will be able to include logic inside of them. Right now I don't have additional information or estimation on when it will be available, but we plan to have updated documentation to go along with it's release.
0Hi Waldo, you can use the new Group Commands to achieve much of the functionality you've described above. However, Group Commands cannot be nested. There is more information on the Group Commands at https://support.workiva.com/hc/en-us/articles/360046166051-Group-Commands-in-a-Chain.
0How is this different to the groups I have been using?
0Additional functionality is allowed now within the Group Commands. For example, Conditional nodes can be added for further logic paths. Another example is you can also initiate the run of child chains from within the Group using the Run Chain command. The new Ground Commands allows additional functionality that could not be included with the old group system.
0
Opmerkingen
9 opmerkingen