Trouble creating a nested list using nested for loops

I have multiples expression rules that gather data as lists, and I am trying to organize them as 1 list to display in a form. 

Long story short I need to show a list of interfaces, and when building the list with nested for loops, I need to add a list to the main list, and it only adds the first item of the list. I have tested the for loop structure, and the fv!itemCount of the inner for loop is 4, and only adds the first value to the main list. Is there a way to add a list to a list as the individual items? 

Basic code structure looks like

forEach(

items: list from variable,

expression: forEach(

items: list from variable,

expression: if(

condition,

forEach(

items: list from expression based on parent for loop value,

expression: interface *Here is where it only adds the first value*

),

interface

)

)

)

 

What do I need to do so this results in a flat list of interfaces? in the if statement I either need to add one interface, or add multiple based on the condition. It currently only adds one interface even when the for loop is given a list of 4 items

  Discussion posts and replies are publicly visible

Parents
  • Appian will try to flatten if you just append or type cast.  Have you considered using dictionary to help preserve the nested list structuring? 

    load(
      local!a: enumerate(9),
      local!b: enumerate(11) + 1000,
      {
        a!forEach(
          items: local!a,
          expression: {
            first: fv!item,
            second: local!b
          }
        )
      }
    )

  • Also, I tried this in a blank expression rule, and I still get a list of 1 item as the dictionary element. I put a second element to show fv!itemCount, and it shows 4 items, but only gives a list of one. I expect this result to show first as a list of SectionLayout: 4 items

    List of Variant: 2 items
    List of Variant: 3 items
    SectionLayout2 (System Type)
    SectionLayout2 (System Type)
    Dictionary
    first: List of SectionLayout2: 1 item
    SectionLayout2 (System Type)
    second: 4
    List of Variant: 2 items
    SectionLayout2 (System Type)
    Dictionary
    first: List of SectionLayout2: 1 item
    SectionLayout2 (System Type)
    second: 4
Reply
  • Also, I tried this in a blank expression rule, and I still get a list of 1 item as the dictionary element. I put a second element to show fv!itemCount, and it shows 4 items, but only gives a list of one. I expect this result to show first as a list of SectionLayout: 4 items

    List of Variant: 2 items
    List of Variant: 3 items
    SectionLayout2 (System Type)
    SectionLayout2 (System Type)
    Dictionary
    first: List of SectionLayout2: 1 item
    SectionLayout2 (System Type)
    second: 4
    List of Variant: 2 items
    SectionLayout2 (System Type)
    Dictionary
    first: List of SectionLayout2: 1 item
    SectionLayout2 (System Type)
    second: 4
Children
No Data