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
  • I hope this helps. 

    a!columnsLayout(
      marginBelow: "NONE",
      spacing: "NONE",
      columns: {
        a!forEach(
          items: 1 + enumerate(2),
          expression: {
            a!localVariables(
              local!outerItem: fv!item,
              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: local!outerItem + (fv!index - 1) * 2,
                            color: "#1a1a00",
                            size: "MEDIUM"
                          ),
                          
                        )
                      },
                      height: "MEDIUM",
                      shape: "ROUNDED",
                      
                    ),
                    
                  )
                },
                
              )
            ),
            a!columnLayout()
          }
        ),
        
      }
    )

Reply
  • I hope this helps. 

    a!columnsLayout(
      marginBelow: "NONE",
      spacing: "NONE",
      columns: {
        a!forEach(
          items: 1 + enumerate(2),
          expression: {
            a!localVariables(
              local!outerItem: fv!item,
              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: local!outerItem + (fv!index - 1) * 2,
                            color: "#1a1a00",
                            size: "MEDIUM"
                          ),
                          
                        )
                      },
                      height: "MEDIUM",
                      shape: "ROUNDED",
                      
                    ),
                    
                  )
                },
                
              )
            ),
            a!columnLayout()
          }
        ),
        
      }
    )

Children