Skip to main content
moulikad5353
August 24, 2023
Question

"sortField" is getting error when the data came from Stored Procedure. Can you please any suggestion how to sort the column when we use stored proc?

  • August 24, 2023
  • 2 replies
  • 0 views

a!gridColumn(
          label: "Conformance",
          sortField: "adherence",          
          value: a!richTextDisplayField(
            label: "Adherence",
            value: {
              a!richTextItem(
                text: if(
                  rule!INO_isBlank(fv!row.adherence),
                  "-",
                  fixed(fv!row.adherence, 2) & "%"/*text(fv!row.adherence /100, "##.##%")*/
                  
                ),
                link: a!dynamicLink(
                  value: fv!row.employee,
                  saveInto: {
                    ri!selectedEmployee,
                    a!save(ri!selectedEmployeeRow, fv!identifier)
                  },
                  showWhen: and(
                    and(
                      not(isnull(ri!showDynamicLinks)),
                      ri!showDynamicLinks
                    ),
                    fv!row.adherence <> 0,
                    not(or(fv!row.employee.isTeamLead))
                  )
                ),
                linkStyle: "STANDALONE",
                color: "STANDARD",
                size: "MEDIUM",
                style: if(
                  and(fv!row.employee = ri!selectedEmployee),
                  "STRONG",
                  "PLAIN"
                )
              ),
              " ",
              a!richTextIcon(
                icon: if(
                  isnull(fv!row.adherence),
                  null,
                  if(
                    todecimal(fv!row.adherence) >= todecimal(local!adhereranceTarget.targetValue),
                    "check-circle",
                    "minus-circle"
                  )
                ),
                caption: "Target Minimum: 95%",
                showWhen: and(fv!row.adherence <> 0),
                color: if(
                  isnull(fv!row.adherence),
                  null,
                  if(
                    todecimal(fv!row.adherence) >= todecimal(local!adhereranceTarget.targetValue),
                    cons!INO_HEX_POSITIVE,
                    cons!INO_HEX_NEGATIVE
                  )
                ),
                size: "MEDIUM"
              )
            }
          )
        ),

This error is showing after clicking "Conformence" column. Because this data came from stored procedure and that's why "sortField" not working proper and we are getting this error. How to sort then?

    2 replies

    ignacio.moran
    August 24, 2023

    It seems you can not sort by a complex type, the column values must be primitive type. Convert / format the values from the store procedure to be primitive. You could check the list of primitives and complex types here:  docs.appian.com/.../Appian_Data_Types.html

    harshk1671
    August 24, 2023

    You can cast stored procedure output into dictionary structure using a!map() function. Also, a datasubset can be created. Use this data while creating grid instead of directly using stored procedure output.