Skip to main content
mayurim3258
January 4, 2024
Solved

Repetitive dynamic layout

  • January 4, 2024
  • 6 replies
  • 0 views

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.

Best answer by harshitb6843

I would suggest making a dedicated interface for showing the details of the items and then you can even call the entire interface in your expression using 'rule!' 

6 replies

konduruc733182
January 4, 2024

Hello mayurim3258,

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']
                          )
                        )
                      }
                    )
                  }
                )
              }
            )
          }
        )
      }
    )
  }
)

harshitb6843
January 4, 2024

I would suggest making a dedicated interface for showing the details of the items and then you can even call the entire interface in your expression using 'rule!' 

abhayd3663
January 4, 2024

Repetition is achieved using forEach() function, it iterates to the list of items and do the processing for each item. The list of items cab be pulled from the DB or any other source and can be provided to forEach() for processing.

mayurim3258
January 8, 2024

Thank you [mention:3e057f937069479fb3712d1807f826e3:e9ed411860ed4f2ba0265705b8793d05]