Sort or Cast text query field

Hello Community,


Trying to sort a query field that is currently text but hold dates.  Was wondering if in the query it might be possible to cast as type date.

Currently attempting to sort the C2 column, however due to it being text it's not correct.

query: a!query(
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 1000,
        sort: a!sortInfo(field: "c2", ascending: true)
      ),
      logicalExpression: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: "c4",
            operator: "includes",
            value: local!activityFilter,
            applyWhen: not(isnull(local!activityFilter))
          ),
          a!queryFilter(
            field: "c1",
            operator: "in",
            value: local!statusFilter,
            applyWhen: a!isNotNullOrEmpty(local!statusFilter)
          ),
        },
        logicalExpressions:  a!queryLogicalExpression(
          operator: "OR",
          filters: {
            a!queryFilter(
              field: "c2",
              operator: "starts with",
              value: "Enrollment"
            ),
            a!queryFilter(
              field: "c2",
              operator: "starts with",
              value: "Screening"
            )
          }
        )
      )

  Discussion posts and replies are publicly visible

Parents
  • Situations like this underline the importance to use correctly-typed data points.  You will not be able to cast to date for sorting within Appian in this situation.  My only suggestion would be to attempt to cast on the DB side within a view, create a new CDT with a date type value for this view, then you may be able to sort and filter more accurately.

Reply
  • Situations like this underline the importance to use correctly-typed data points.  You will not be able to cast to date for sorting within Appian in this situation.  My only suggestion would be to attempt to cast on the DB side within a view, create a new CDT with a date type value for this view, then you may be able to sort and filter more accurately.

Children