• DOCUMENTATION
  • WORKATO BLOG
  • PRODUCT BLOG
  • Return to Workato
  • Log in
  • ☰
  • Community/Discussions
Solution home Formula Mode Tips & Tricks Text Manipulation Formulas

Comparing values and setting field values based on that

Modified on: Thu, Jul 20, 2017 at 12:03 PM

Is there a way to compare dates in a formula in Workato?


An event has an expiration_date field. In an action, I want to set a status field based on whether the expiration_date has passed. I want to write something like this:

Answer:
Assuming expiration_date is a Date field the formula will work as follows
expiration_date > now ? “Expired” : “Active”

The formula mode supports 'now' and 'today' which return time and date at the time of invocation.

If the expiration_date is a string, then convert the string to time. 
expiration_date.to_time > now ? “Expired” : “Active”
This will work assuming string is in 2015-07-09 11:31:58 -0700 format.

If the string is in custom format, then do the following:
expiration_date.to_time(format: 'MM/DD/YYYY') > now ? “Expired” : “Active”

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

Related Articles

    Still can't find your solution?

    Visit our forums to search for answers, or post your own questions.

    Documentation
    Developer's Library
    Tutorials
    eBooks
    Product Hour
    Product Blog
    Workato Blog
    Product updates
    Customer Stories
    © Workato 2020   Privacy   Terms   +1 (844) 469-6752
    • Documentation
    • Workato Blog
    • Product Blog
    • Solutions
    • Forums
    • Tickets
    • Log in
    • Return to Workato