Skip to main content
December 9, 2021
Question

Trying to Display data in read-only grid

  • December 9, 2021
  • 1 reply
  • 0 views

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!gridField [line 497]: A grid component [label="null"] has an invalid value for "data". "data" must be sourced from a Record Type, a query, a list of Dictionary, a list of CDT, or a data subset. Received: Text

I'm trying to refactor the code to display the data in read-only grid the previous version is with a!gridSelection() which is passed form expression rule to an interface to handle a!pagingInfo() and as per my understanding a!gridSelection() is deprecated and instead a!gridField() should be used.

rule!abc_expression(

     select:rule!selectionFilter(),

     queryFilters:{

              rule!queryFilter(),

              a!queryLogicalExpression()

             },

    pagingInfo: ri!gridSelection.pagingInfo

)

------------------------------------------------------------------------------------------

                                     Interface

--------------------------------------------------------------------------------------------

local!define: a!gridSelection(
                         pagingInfo: a!pagingInfo(
                                                   startIndex: 1,
                                                   batchSize: 20,
                                                   sort: a!sortInfo(
                                                               field: "name",
                                                               ascending: true
                                                              )
                                                   )
                                             )

local!first: rule!abc_expression(

                         gridSelection: local!define,

                        input: one,

                       input:two

                     )

local!dataSubset: todatasubset(
                   rule!cde_Index(
                                   path: "id",
                                  dictionary: local!first
                           )
)

-----------------------------------------------------------------------------

                 Grid code to display in interface

------------------------------------------------------------------------------

a!gridField(
     data: rule!cde_Index(
                  path: "data",
                 dictionary: local!dataSubset
),
columns: {
         a!gridColumn(
                     label: "id",
                   value: rule!PRO_TK_Index(
                               path: "id",
                               dictionary: fv!row
                 )
              )
},
pagingSaveInto: {
            a!save(
                target: local!define,
                value: save!value
            ),
          a!save(
               target: local!first,
               value: rule!abc_expression(
                              gridSelection: local!define,
                                           input: one,
                                           input:two
                    )
),
        a!save(
                  target: local!dataSubset,
                  value: todatasubset(
                               rule!cde_Index(
                                       path: "id",
                                       dictionary: local!define
                                 )
                           )
                   )
         }
)

So I'm getting following error highlighted in red colour can someone help me to understand this and fix it.

1 reply

andrewh0007
December 9, 2021

You're passing in the wrong data type for the data field of the a!gridField() function. There is a lot of information on this in the documentation: https://docs.appian.com/suite/help/21.4/Paging_Grid_Component.html.

But to get to the heart of the issue it looks like you're indexing to just "id" in the local!dataSubset variable which appears to return an array of Text. Not sure what the point of putting it into a datasubset is when you don't utilise it to sort anything and then in the data field of the a!gridField() function you index straight back to "data" again.

I would pass into the data field the local!first variable and check out the documentation linked above.