Add parameters to the SQL query

A Score Level 1


I want to query the audit-login file with the queryappianlogs() function. The query is like this:

sqlStatement:"SELECT Username FROM login-audit
WHERE Timestamp >= '2020-05-01' AND Timestamp < '2020-05-30'
ORDER BY Timestamp DESC"

I want to get all the username during a period of time, but I need to add the dates dynamically. Is any way to do that, to put a rule input or local variable as parameter inside the query?

Thank you in advance!

  • Hello,

    did not find documentation regarding this queryappianlogs. However, if you can request the data already, it is a matter of working with it after calling it. I would try as well with a Process Report to have that data. Then a processAnalytics function to call your data and filter it out.

  • I don't assume this will work as Appian doesn't keep more than a day's worth of logins in the main login-audit.csv file - every time a new day begins (at least as of the first user login for that day), the existing login-audit.csv is renamed to a specific date-stamped file and a new login-audit.csv is created to be filled fresh.  The method I've needed to employ to get around this is running a nightly process where I query the full file from the prior day and write it all to my own DB table (making sure to check for duplicate rows), and then of course you can easily query that table later.

 Discussion posts and replies are publicly visible