Add parameters to the SQL query

Certified Senior Developer

Hello!

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

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

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!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    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.

Reply
  • 0
    Certified Lead Developer

    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.

Children
No Data