Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!

Iterator Module Not Fully Iterating

Avatar

Level 1

Hi Everyone!


We are running into an issue when trying to parse data that comes from an HTTP GET request. As you can see in the first picture below we are parsing the "data" header that was retrieved from the HTTP request. Then we take that parsed JSON data and iterate the "rows" of the JSON to get all of the values returned to us in a way that can be used later on in the scenario. But for some reason the iterator only returns one of array indexes.

Any help on getting all of the array indexes would be greatly appreciated.

 

Thanks in advance!Screenshot 2023-11-16 at 10.55.37 AM.pngScreenshot 2023-11-16 at 10.57.52 AM.pngScreenshot 2023-11-16 at 10.58.01 AM.png

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

7 Replies

Avatar

Community Advisor

Data is not being interpreted as an iterable object by Fusion. Can you post an obfuscated example of what's in Data?

Avatar

Level 1

Hi Chris thanks for the reply,

 

Here is what data looks like. I hid most of the actual data and replaced the datasourceID with DATASOURCE

"data": "{\"datasource\":\"DATASOURCE\",\"columns\":[\"AD.surname\",\"AD.givenname\",\"allLowerEmail\",\"AD.title\",\"AD.Supervisor Full Name\",\"AD.FederationID\"],\"metadata\":[{\"type\":\"STRING\",\"dataSourceId\":\"DATASOURCE\",\"maxLength\":-1,\"minLength\":-1,\"periodIndex\":0,\"aggregated\":false},{\"type\":\"STRING\",\"dataSourceId\":\"DATASOURCE\",\"maxLength\":-1,\"minLength\":-1,\"periodIndex\":0,\"aggregated\":false},{\"type\":\"STRING\",\"dataSourceId\":\"DATASOURCE\",\"maxLength\":-1,\"minLength\":-1,\"periodIndex\":0,\"aggregated\":false},{\"type\":\"STRING\",\"dataSourceId\":\"DATASOURCE\",\"maxLength\":-1,\"minLength\":-1,\"periodIndex\":0,\"aggregated\":false},{\"type\":\"STRING\",\"dataSourceId\":\"DATASOURCE\",\"maxLength\":-1,\"minLength\":-1,\"periodIndex\":0,\"aggregated\":false},{\"type\":\"STRING\",\"dataSourceId\":\"DATASOURCE\",\"maxLength\":-1,\"minLength\":-1,\"periodIndex\":0,\"aggregated\":false}],\"rows\":[[\"surname\",\"givenname\",\"allLowerEmail\",\"title\",\"Supervisor Full\",\"Federation ID\"]],\"numRows\":1,\"numColumns\":6,\"fromcache\":true}",

 

Avatar

Community Advisor

Ok, so it looks like you're array is contained in data[columns], is that correct? If so, that's what you need to map into your iterator, get({{data}};columns).

Avatar

Level 1

This is what I have based off of what you said, but this returns an empty array. (Rows contains the values I need). Am I doing something wrong? Screenshot 2023-11-16 at 3.42.53 PM.png

Avatar

Level 6

Is the data being encoded as a string?  If so, you may need to parse as an object first before you attempt to get the "column" member.  Something about the way your sample data was posted is just triggering my spidey sense....

Avatar

Community Advisor

Don't put the squirrely brackets in, sorry. They're already embedded if you click the collection. Also, I told you the wrong field. It should be the output of the JSON parser that you are loading {{21. Data}} into, not the raw string, sorry about that. If you can just pick the rows collection coming out of the JSON parser, then you can just do that, you don't need the whole get statement.

Avatar

Level 1

So I've spent the whole day putzing with this scenario. I can't figure out what the issue quite is. I tried parsing the data object using HTTP module and the JSON modules. Neither have gotten me very far - as for Chris' advice, the get function returns an empty array. I was able to iterate off the parse module and got this result which contains all the column values from the data object, but it doesn't appear I have the ability to reference any of these rows in another moduleScreenshot 2023-11-17 at 4.30.22 PM.png (I tried to iterate off of the "Value" response from this result to no avail).