Solved

How to get lists of data from a Json Call?

  • 1 March 2024
  • 2 replies
  • 58 views

Userlevel 3
Badge +1

For a near future project we want to get capability data on terms. We have a graphQL query to get this data (the hardcoded gid is just for experimentation sake. It will be parameterized of course):

query GetCapabilities_term {   term(gid:  "5877cd9a-0000-7000-0000-000000b63f13") {     gid     assignedIdentities {       capability {         name         id         operationSets {           name           displayName           id         }       }       identity {         ... on Role {           name           ... on GroupRole {             name             gid           }         }       }     }   } }

 

I've created this very simple component to explore working with this data.

 

 Here is the Json Call:

And the data stream in the Json Call:

It runs the graphQL query and gets the results. In the Json Call debug with response data I can see the call was successful and we have data.But it will get multiple results for multiple capabilities. This Json Call just writes the last line of the list to the output file. 

 

Is there a way to write the whole list to the output file?

 

icon

Best answer by AKislyakov 4 March 2024, 00:39

View original

2 replies

Userlevel 4
Badge +4

Hi @Marcel-Jan,

Number of rows in the output is determined by number of nodes fetched by the Path expression ($.data in your case). To get distinct rows for every capability you need to create a child Data Stream with the Path assignedIdentities.capability. Same goes with operationSets, you need to create yet another child stream to fetch every operationSet. In general your hierarchy of Data Streams should reflect hierarchy of JSON nodes. Good news is that you can include attributes from parent streams via Shadow columns section.
 

 

Userlevel 3
Badge +1

Hi @AKislyakov 

I've tried this out. I now understand how it works. (And why you would want to have data streams within data streams).

Thanks for explaining!

Reply