So, I am trying to capture and store nested data from USDA Database - API (image below)
Now I am trying to store this data in a record - fields being gtinUpc, number, name, amount, and unitName. I am trying to use the forEach-nested loop example from
https://docs.appian.com/suite/help/23.1/fnc_looping_a_foreach.html.
However, when I try to nest another forEach and iterate over the foodNutrients, I get errors. I have tried moving lines around - for example, move line 21 to outside the inner a!localVariables - nothing seems to work.
As always, any and all feedback/assistance would be appreciated.
Thanks
Discussion posts and replies are publicly visible
Hello Mana, the ":" notation is just a declaration at the beginning of your form or expression rule to define your locals. not assignend values later:so here its lesse with the iteration lopping its with your ":" notationDo you want to create a new record value set or update an existing one?
Helo Richard:
I am trying to populate the record values for now but in the long run, these records will be updated based on any updates done by the API-source (USDA Foods).
Ma
perhaps this one is helping you.So what I am saying: I see rather an issue how you create/update data IN your a!forEach than your a!foreach logic itself.
Hi Richard:
You are right in that is what I am trying to do. However, I have nested data to process and that is where I am getting errors.
The data I want is List of variant with two a "product code" and detailed information below that. I would like to store the data in a table similar to the image at the bottom.
I know this must be basic - but I am trying to learn Appian.
super stupid question? did you watch the record videos in the appian academy?get away from the idea of nesting (concept of the old "CDT" world)try to use record relations between records. so your task would be getting a correct foreign key relation between your two records. Idea:"product code"one to many relationfood nutrients (or how ever the element should be called)why not using a record here with the data structure you like to have?