When extracting data from a PDF, the date is returned as a string, for example, "May 12th 2026" or "Apr 4th 2026". However, the corresponding field in the database is of type Date, so passing the string directly will not work.
How would you convert this extracted string into a valid Appian Date before writing it to the database?
Answer
I would use an expression rule to convert the extracted date string into an Appian Date before passing it to the database.
For example, if the extracted date is "May 12th 2026", I would first split the string into its month, day, and year.
Then I would remove the ordinal suffix from the day, such as st, nd, rd, or th, and use the date() function to construct a valid Appian Date.
Here is the expression I would use:
I would create a separate expression rule, for example rule!convertStringToDate(), and call that rule wherever I need to convert an extracted date string.
This makes the logic reusable and keeps the process model clean.Then, before writing the data into the database, I would call this function and pass the extracted date string. The function would return an Appian Date, which I would then map to the corresponding Date field in the database.