How to work with Fields that might not exist and avoiding Parse Errors
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I want to do two things (with some caveats)
- Check if a field, which might or might not exist, IsNull with the Message tool.
- Avoid getting an error warning that the field doesn't exist when adding the above to a Macro.
My use case is that I'm running a Rest API call using the Download tool. It returns some XML which I pass to the XML Parse tool.
If the call is successful, then the Parse Tool outputs a "createdAt" field. If not, it doesn't.
In the Message tool I have "IsNull([createdAt])"for the test.
I'm in a catch-22. When I add this to a macro and include it in a workflow, I get a Parse Error/Warning that the field [createdAt] doesn't exist. (the workflow runs fine..but the error is confusing if I want to share the macro with coworkers)
If I use the formula tool to create the field with a null then the warning goes away....
but...the XML Parse tool checks for before create the field so it creates it as [createdAt2] which is no good.
DynamicRename won't let me remove the 2 because [createdAt] already exists.
What is the best practice for this? It seems like a common use case, no?
Many Thanks,
Alex
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Personally, I would put a Filter tool after your Download or XML Parse and do a check if the call was successful in it. You will avoid errors then and will be able to configure your Message tool easily.
If after the Filter or XML Parse tool you have missing field errors, just add a field in a Text Input (just put field names, with no rows) and introduce it via Union.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
OK, that's helpful/practical advice. Thanks!
I can do a filter after the Download tool using the DownloadData field it creates....
(but I can't after the XML Parse because the filter would be on a field that might not exist.....)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@AlexApolloni did this tip solve all of the issues? If so, please mark my answer as the solution.
