Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Re-ordering dynamic list

Certified Lead Developer

We have a dynamic array containing lists of data. Dynamic here meaning data1, data2..etc could be any length.

We need a screen that allows users to reorder this data and we are attempting to do this with a gridLayout with allowRowReordering = true.

When attempting this example below, we are seeing the error Expression evaluation error at function a!gridLayout [line 15]: A grid layout component [label="data1"] has an invalid value for "rowOrderData". The value must be a list of records, a list of maps, or a list of dictionaries.

a!localVariables(
  local!map: { "data1", "data2" },
  local!data: {
    data1: {
      { sortOrder: 1, label: "A" },
      { sortOrder: 2, label: "B" }
    },
    data2: {
      { sortOrder: 1, label: "C" },
      { sortOrder: 2, label: "D" }
    }
  },
  a!forEach(
    items: local!map,
    expression: a!gridLayout(
      label: fv!item,
      headerCells: {
        a!gridLayoutHeaderCell(label: "Checklist Sections")
      },
      rows: a!forEach(
        items: local!data[fv!item],
        expression: a!gridRowLayout(
          contents: a!textField(value: fv!item.label, readOnly: true)
        )
      ),
      allowRowReordering: true,
      rowOrderData: local!data[fv!item],
      rowOrderField: "sortOrder"
    )
  )
)

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    This worked for me:

    a!localVariables(
      local!map: { "data1", "data2" },
      local!data: a!map(
        data1: {
          a!map(sortOrder: 1, label: "A"),
          a!map(sortOrder: 2, label: "B")
        },
        data2: {
          a!map(sortOrder: 1, label: "C"),
          a!map(sortOrder: 2, label: "D")
        }
      ),
      a!forEach(
        items: local!map,
        expression: a!gridLayout(
          label: fv!item,
          headerCells: {
            a!gridLayoutHeaderCell(label: "Checklist Sections")
          },
          rows: a!forEach(
            items: local!data[fv!item],
            expression: a!gridRowLayout(
              contents: a!textField(value: fv!item.label, readOnly: true)
            )
          ),
          allowRowReordering: true,
          rowOrderData: local!data[fv!item],
          rowOrderField: "sortOrder"
        )
      )
    )

Reply
  • +1
    Certified Lead Developer

    This worked for me:

    a!localVariables(
      local!map: { "data1", "data2" },
      local!data: a!map(
        data1: {
          a!map(sortOrder: 1, label: "A"),
          a!map(sortOrder: 2, label: "B")
        },
        data2: {
          a!map(sortOrder: 1, label: "C"),
          a!map(sortOrder: 2, label: "D")
        }
      ),
      a!forEach(
        items: local!map,
        expression: a!gridLayout(
          label: fv!item,
          headerCells: {
            a!gridLayoutHeaderCell(label: "Checklist Sections")
          },
          rows: a!forEach(
            items: local!data[fv!item],
            expression: a!gridRowLayout(
              contents: a!textField(value: fv!item.label, readOnly: true)
            )
          ),
          allowRowReordering: true,
          rowOrderData: local!data[fv!item],
          rowOrderField: "sortOrder"
        )
      )
    )

Children
No Data