Nested ForEach and localVariable

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

Parents Reply Children
  • 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.

  • 0
    Certified Senior Developer
    in reply to MaNa

    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 relation
    food nutrients (or how ever the element should be called)

    why not using a record here with the data structure you like to have? Slight smile