Nested for each

I have used nested foreach and cardlayout inside that

im getting the below output.

Below is my code.

a!columnsLayout(
                    marginBelow: "NONE",
                    spacing: "NONE",
                    columns: {
                      a!forEach(
                        items: 1+enumerate(2),                       
                        expression: {
                          a!localVariables(
                                                       
                        a!columnLayout(
                          contents: {
                            a!forEach(
                              items:1+enumerate(2),
                              expression:                 
                            a!cardLayout(
                              style: "INFO",
                            
                              contents: {
                                a!richTextDisplayField(
                                  labelPosition: "COLLAPSED",
                                  align: "CENTER",
                                  value: a!richTextItem(                                   
                                    text:fv!item,
                                    color: "#1a1a00",
                                    size: "MEDIUM"
                                  ),                           )
                              },
                              height: "MEDIUM",
                              shape:"ROUNDED",
                             
                            ),
                         
                            )                           
                            },                         
                        )
                      ),a!columnLayout()
                    }
                  ),
                
                }
              )

Instead of printing 1 1

                              2  2

I want to display as 1 2

                                3 4.

how to achive this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    check this one out

    a!localVariables(
    local!number: 5,
    local!row: 2,
    local!remainder: local!number - quotient(local!number, local!row) * local!row,
    if(
    local!number<local!row,
    null(),
    a!columnsLayout(
    marginBelow: "NONE",
    spacing: "NONE",
    columns: {
    a!forEach(
    items: 1 + enumerate(local!row),
    expression: {
    a!localVariables(
    local!currenColumn: fv!item,
    {
    a!columnLayout(
    contents: {
    a!forEach(
    items: 1 + if(
    local!remainder = 0,
    enumerate(quotient(local!number, local!row)),
    enumerate(quotient(local!number, local!row) + 1)
    ),
    expression: a!richTextDisplayField(
    labelPosition: "COLLAPSED",
    align: "CENTER",
    value: if(
    and(local!remainder <> 0, fv!isLast),
    if(
    contains(
    enumerate(local!remainder) + 1,
    local!currenColumn
    ),
    index(
    symmetricdifference(
    enumerate(local!number) + 1,
    enumerate(local!number -local!remainder) + 1
    ),
    local!currenColumn,
    null()
    ),
    null()
    ),
    local!currenColumn + (fv!index - 1) *local!row
    ),

    )
    )
    },

    ),

    }
    ),

    }
    ),

    }
    )
    )
    )

  • Just to note, please utilize the Insert Code option here when posting snippets for readability:

Reply Children
No Data