Bug in skip condition check for Advanced Query?
BeantwoordI have a List Files command that produces an empty list because my table has no files. I can see its output is [] (for deprecated json). The next node is "Convert JSON to CSV". It has a skip condition called "Success -> String File List (Deprecated) = []". When the process executes, the Convert JSON to CSV step completes with a green circle. The output is listed as "Output CSV converted_1594320964943.csv". The Log shows:
JSON to CSV Configuration:
Input File: files_1594320962037.json
Output File:
Preview result: true
Command description: Converts a JSON array of objects to a CSV file
======== START PREVIEW ========
======== END PREVIEW ========
Result: Success
All good so far. The step clearly did not create an output file since the input file was an empty array and the skip condition told it to skip. The output is sent to Advanced Query to get the fileid from the files table. It has the same skip condition - so I want it to skip if the input if the List Files command had an empty output. However this step fails because presumably there is no input file, even though I am telling it to skip:
🔌 Tabular Transformation 1.5.0
⚙️ Command Configuration: 1
Input file: None
Output file: <none>
Delimiter: ,
Preview: true
Header line: 0
Command: Query
Query: select id from files where name = 'Transformed-Department A.csv'
Tables: [{"file":"converted_1594320964943.csv","table":"files"}]
Output Delimiter: ,
Querying file...
Loading table: files
2020/07/09 18:56:07 EOF
Error: exit status 1
Elapsed Time: 88.768845ms
Return Code: 2
Exit message: exit status 1
Status: ❌
So does the skip command logic fire AFTER the command evaluated its inputs? If so this kind of approach will not work.
-
Hi Waldo, we are looking into the skip logic backend at this time. In the meantime, I'd recommend migrating your Chains off of the deprecated list files output.
0Thanks. The only reason I used the deprecated result is because I could not get the other one to work. Files List returned something that I did not know how to match against an empty array to skip if no records were returned.
0Hi Waldo, I wanted to follow up on the Skip Conditions behavior. We have identified a fix and expect to have it live either end of this week or early next week. Thank you for point this out to us.
Additionally, to replace the Convert JSON to CSV command using the deprecated files list, I recommend looking at the node Array to CSV in the JSON bizapp (https://support.workiva.com/hc/en-us/articles/360036005871-JSON-Commands#section1) and select the 'Files List' from the output of the 'List Files' command.
0Will check it out.
0Hi Jeff,
Even I am trying to add a skip condition to the "un-import file from table" command after the "List files" command. I want to skip when List files has an empty JSON string. I can not figure out how the skip condition will work here.
I tried a bunch of combinations here both with file list and file list deprecated, but none seem to work:
- JSON file list is blank
- String file list is blank
- JSON file list = (empty)
- String file list = (empty)
- String file list (0) is blank
Will be helpful if you can help me write the skip condition here.
I am trying to avoid using the JSON-array to CSV and Tab transformation- filter rows count just for the skip condition.0Hi Krishma. If you are iterating over a list of files to unimport, I imagine that you have the commands in a Group. If the List Files returns an empty array, the Group will be skipped assuming you've configured it to iterative over the list. If you've configured it a different way, the easiest way may be to use a Conditional command prior to your unimport to check if the array has a value in the first index or not. If there is a value, then you know that at least one file is in the table.
0Hey Jeff,
Thank you for your response. Even for the conditional command, the challenge remains the same.
If I pass the "file list" (from list files command) as is, it is a file name, hence gives an error. I have attached the screenshot of the log below:
When I pass the "file list" using "get value from JSON", I get the "Error executing transformation "path not found [0]"" error when the wdata table doesn't have any dataset, hence list files is empty.
Also attaching the screenshot of my skip/conditional conditions. Can you spot anything I could do differently here?0The error "Error executing transformation "path not found [0]"" only happens when the array is empty, meaning no file are present in the table. When one or more files are present in the table, path 0 to n will be in the array so the error will not be thrown. You could use this information in your conditional check.
0Hi Jeff,
I understand the conditional check now. Below is the chain I am iterating, but not over list files. I only want to skip "Get file properties" and "un-import" commands and proceed with the onward command for importing the latest file in the chain in the same iteration. With conditional, the remaining iteration stops entirely.
One workaround I could think of is creating two group nodes and iterating un-import of all the tables, followed by import of all the tables in the second iteration.
Is there any other better and neater solution, that you would rather recommend?0I'm not sure I fully follow the use case described. From your description and image you provided, I believe that your Chain is grabbing some information from a Sheet and iterating over that data. For each piece of data, it attempts to remove old data from a table and then get new data from Oracle and import that. Is this the correct logic of the Chain? If this isn't correct, could you provide more information about your Chain and use case.
If the above description is correct, then you could do this by following this tutorial https://support.workiva.com/hc/en-us/articles/360047103831-Update-datasets-in-a-table-as-a-chain. It takes some input for the Run Time input which in your case could be the extracted data and/or the data from Oracle. It checks to see if an old file exists and removes it. Then it imports the new file. You may be able to adapt this to your Chain so that it is called within the Group iteration.
0U moet u aanmelden om een opmerking te plaatsen.
Opmerkingen
10 opmerkingen