Repetitive dynamic layout

Certified Senior Developer

Hi, I am building a page where I need to show the list products available in my database in a particular interface. It's like a product inventory. Is there any object to show repetitive dynamic layout which will display a specific section repeatedly for the number of products available in my database.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    Hello ,

    You can simply write your expression in a!forEach(). In the Items add your product data and in the expression configure your section/card of how you are planning to display the data.

    a!localVariables(
      local!products: rule!XXX_QR_getProductXXXDetails(isActive: true),
      {
        a!forEach(
          items: local!products,
          expression: {
            /*Create and expression rule for this and call it here instead of having the whole code*/
            a!cardLayout(
              shape: "ROUNDED",
              padding: "MORE",
              marginBelow: "STANDARD",
              contents: {
                a!sectionLayout(
                  label: concat(
                    fv!index,
                    ". ",
                    fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}productName']
                  ),
                  divider: "ABOVE",
                  contents: {
                    a!columnsLayout(
                      columns: {
                        a!columnLayout(
                          contents: {
                            a!textField(
                              label: "SKU Code",
                              value: fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}productSKU'],
                              readOnly: true
                            ),
                            a!paragraphField(
                              label: "Description",
                              value: fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}productDescription'],
                              readOnly: true
                            )
                          }
                        ),
                        a!columnLayout(
                          contents: {
                            a!imageField(
                              size: "LARGE",
                              images: a!documentImage(
                                document: fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}image']
                              )
                            )
                          }
                        )
                      }
                    )
                  }
                )
              }
            )
          }
        )
      }
    )

Reply
  • +1
    Certified Senior Developer

    Hello ,

    You can simply write your expression in a!forEach(). In the Items add your product data and in the expression configure your section/card of how you are planning to display the data.

    a!localVariables(
      local!products: rule!XXX_QR_getProductXXXDetails(isActive: true),
      {
        a!forEach(
          items: local!products,
          expression: {
            /*Create and expression rule for this and call it here instead of having the whole code*/
            a!cardLayout(
              shape: "ROUNDED",
              padding: "MORE",
              marginBelow: "STANDARD",
              contents: {
                a!sectionLayout(
                  label: concat(
                    fv!index,
                    ". ",
                    fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}productName']
                  ),
                  divider: "ABOVE",
                  contents: {
                    a!columnsLayout(
                      columns: {
                        a!columnLayout(
                          contents: {
                            a!textField(
                              label: "SKU Code",
                              value: fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}productSKU'],
                              readOnly: true
                            ),
                            a!paragraphField(
                              label: "Description",
                              value: fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}productDescription'],
                              readOnly: true
                            )
                          }
                        ),
                        a!columnLayout(
                          contents: {
                            a!imageField(
                              size: "LARGE",
                              images: a!documentImage(
                                document: fv!item['recordType!{2b924bf1-5a42-XXX}XXX PCCoot XXX Detail.fields.{eb4513cb-275e-4a41-b750-XXXX}image']
                              )
                            )
                          }
                        )
                      }
                    )
                  }
                )
              }
            )
          }
        )
      }
    )

Children