Dear all,
I am trying to get data from the DB to show milestone and trying to figure out how to build a query rule to return the index of the last non-null value a list of rows. See the attached picture. How can I code this query rule to return the last non-null index of the approverDecision column? In this case, the index is 2 (the last non null approverDecision row).
Thanks
Discussion posts and replies are publicly visible
Actually I'd take a different approach. Leverage the power of the database and create a VIEW that selects all of the data you want returned from the row, and in the selection criteria use the MAX(Index) WHERE "ApproverDecision' IS NOT NULL AND 'ApproverDecisionDate' IS NOT NULL to select the one row you want returned. Now you have your VIEW it'll be straightforward to simply return the content of that VIEW into Appian.
Thanks, is there a quick guide to creating a CDT from views?
It;'s pretty straightforward. Create a new CDT, select the option to create from a database object, pick the Datastore that points to your DB, then pick the VIEW. You'll then get a dialogue to set the attributes of the CDT. Things to remember:
...here's the official documentation:
https://docs.appian.com/suite/help/20.1/Mapping_CDTs_to_Pre-defined_Database_Tables.html
Thanks again.