gridLayout: Unable to save selected rows in gridRowLayout to a local variable

Hi everyone,

Please help check whether I'm doing anything wrong in below code. I'm having an editable grid with data source is a data subset local variable. In gridRowLayout I already provided the id for identifying, and save the selected ID into a blank local variable. But when I select each row, it's value is not stored into my local variable. I also tried with fv!index but that did not work either. 

Below is the data subset local variable. I indexed into it's data.fileId field. 

  Discussion posts and replies are publicly visible

Parents Reply Children
  • I finally found the issue, it is a long story how I traced it down, but if you try this simplified code you will understand the situation: 

    a!localVariables(
      local!data: 'type!{http://www.appian.com/ae/types/2009}DataSubset'(
        'startIndex': 1,
        'batchSize': 10,
        'sort': { null },
        'totalCount': 10,
        'data': {
          {
            fileId: "123"
          },
          { fileId: "456" }
        },
        'identifiers': {
          "123",
          "456"
        }
      ),
      local!selectedAzureIds,
      a!gridLayout(
        label: "Documents",
        labelPosition: "COLLAPSED",
        headerCells: { a!gridLayoutHeaderCell(align: "CENTER") },
        columnConfigs: { a!gridLayoutColumnConfig(weight: 4) },
        rows: a!forEach(
          items: local!data.data,
          expression: a!gridRowLayout(
            id: fv!item.fileId,
            contents: {
              a!richTextDisplayField(
                value: {
                  a!richTextIcon(
                    icon: "download",
                    size: "MEDIUM",
                    color: "ACCENT",
                    linkStyle: "STANDALONE",
                    link: a!safeLink(uri: datetext(now(), "yyyymmddHms"))
                  )
                },
                align: "CENTER"
              )
            }
          )
        ),
        selectable: true,
        selectionValue: local!selectedAzureIds,
        selectionSaveInto: {
          a!save(local!selectedAzureIds, save!value),
    
        },
        rowHeader: 1
      )
    ),

    And this is how I fixed it, just wrap the URL link into a local variable and use its output

    a!localVariables(
      local!data: 'type!{http://www.appian.com/ae/types/2009}DataSubset'(
        'startIndex': 1,
        'batchSize': 10,
        'sort': { null },
        'totalCount': 10,
        'data': {
          {
            fileId: "123"
          },
          { fileId: "456" }
        },
        'identifiers': {
          "123",
          "456"
        }
      ),
      local!selectedAzureIds,
      a!gridLayout(
        label: "Documents",
        labelPosition: "COLLAPSED",
        headerCells: { a!gridLayoutHeaderCell(align: "CENTER") },
        columnConfigs: { a!gridLayoutColumnConfig(weight: 4) },
        rows: a!forEach(
          items: local!data.data,
          expression: a!gridRowLayout(
            id: fv!item.fileId,
            contents: {
              a!richTextDisplayField(
                value: {
                  a!richTextIcon(
                    icon: "download",
                    size: "MEDIUM",
                    color: "ACCENT",
                    linkStyle: "STANDALONE",
                    link: a!safeLink(uri: a!localVariables(
                      local!url: datetext(now(), "yyyymmddHms"),
                      local!url))
                  )
                },
                align: "CENTER"
              )
            }
          )
        ),
        selectable: true,
        selectionValue: local!selectedAzureIds,
        selectionSaveInto: {
          a!save(local!selectedAzureIds, save!value),
    
        },
        rowHeader: 1
      )
    ),

    Even though I was able to fix it, I still don't know why it does not work, if someone can explain me that would be great :/

  • 0
    Certified Senior Developer
    in reply to mollyn126

    The issue in the first code is on line 36, where you're using the DateText function. The DateText function converts a date or datetime into a string. If you use the text() function instead This will work as expected.