When extracting data from a PDF, the date is returned as a string, for example, "May 12th 2026" or "Sep 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?
When extracting data from a PDF, the date is returned as a string, for example, "May 12th 2026" or "Sep 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.
Take "May 12th 2026" as the extracted value. The rule splits it on spaces into month, day, and year, strips the ordinal suffix (st, nd, rd, th) from the day, and builds the date with date():
Output:
I’d save this as its own rule, for example rule!convertStringToDate(), so anywhere that handles an extracted date string can call it and the process model stays simple. Before writing to the database, I pass the extracted string to the rule and map the Date it returns to the date field.
For more coding challenges ref : https://appianverse.com/coding
Try it yourself
Change the inputs or the expression and run it to see what it returns.
Independent evaluator: it approximates the Appian expression language and may differ from a real Appian environment. Verify anything that matters. Terms