Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Select tool - handle missing fields with default value

toral
6 - Meteoroid

Hi,

 

I have an iterative macro that receives json response, parses the same into csv and then outputs the selected fields. 

The response payload is a bit dynamic in the sense it won't return all the fields always. Like: 

{
     "elements": [
     {
         "type": "abc",
         "currentStatus": "Pending",
         "id": "12345",
         "city": "Chicago",
         "country": "United States"
}]}

 

and sometimes: 

{
     "elements": [
     {
         "type": "abc",
         "currentStatus": "Pending",
         "id": "8765",
         "country": "United States"
}]}

 

City is missing in the second response.

The select tool does not identify a field such as City and the final output csv structure changes from 5 fields to just 4.

The select tool says missing fields when the city field is not available. 

 

What's the best way to handle this. 

 

I want the output to be all the 5 fields 

 

Attached a snapshot of the workflow: 

 

macro.JPG

1 REPLY 1
toral
6 - Meteoroid

This was handled by adding a 0 record file (skeleton file) with the fields of interest. This skeleton merged with the select output gave the final consistent result as needed. 

Labels