Skip to main content
Gainsight Employee ⭐️
July 8, 2021
New Idea

Ability to have date type in the Case statement - Rules engine

Related products:CS Rules Engine
  • July 8, 2021
  • 13 replies
  • 233 views

 

 

The out data type here is limited to number, string and boolean. But we have encountered multiple usecases where the final out put fields needs to a date based on set of conditions/criteria.

Is this something in road map?

This ability to have date type in the case statements is not a possibility in Data Designer also.

If we can have the ability then it would be super helpful

13 replies

rakesh
Gainsight Employee ⭐️
Lets put your data to work!
July 9, 2021

Hi @shivani 

This is a good idea. Can you also add some usecases that you might want to accomplish with case and dates?

Contributor ⭐️⭐️
September 14, 2021

Company has sales orders and change orders to the original sales order. Sales order always has a service start and service end dates. Change order should have the same but not always depending on the reason for the change order.

If I’m pulling products out of the change order and need to have the service start and end date then the logic would be:

If change order service start date is null
then sales order service start date
else change order service start date

Same for service end date

Contributor ⭐️⭐️⭐️⭐️
August 5, 2022

Here is another use case. I’m trying to unify 2 data sets in rules, and I need to aggregate a date field. If one dataset has null value in the date field, then I want to use the date from the other dataset so that the result is a single date field to be inserted in a custom object. 

NVL or coalesce would be great to have too. It would solve for this use case.

 

romihache
VIP ⭐️⭐️⭐️⭐️⭐️
October 4, 2022

At the moment I’m having the same issue, my use case is the same as above.

Continuous improvement is better than delayed perfection
alizee
VIP ⭐️⭐️⭐️⭐️⭐️
February 9, 2023

Absolutely required, why is it not a thing yet?

The most expensive part of building is the mistakes. That's true in construction. Not so much in CSOps. So ask questions, make mistakes and learn. All views expressed here are my own.
Contributor ⭐️⭐️⭐️
April 27, 2023

Here is another use case. I’m trying to unify 2 data sets in rules, and I need to aggregate a date field. If one dataset has null value in the date field, then I want to use the date from the other dataset so that the result is a single date field to be inserted in a custom object. 

NVL or coalesce would be great to have too. It would solve for this use case.

 

This is a persistent scenario we run in to (wanting to consolidate two or more different Date Fields into a single Date Field) and was hoping to see a new Date field type for Case Fields in the new Horizon Rule Designer.

In order to accomplish this today, I need to split off multiple Transforms that filter in just the filled Date field, renaming their output Date field identically in the Transforms so that I can Union each set back together and then Merge the new consolidated Date field back in to the master dataset.  Multiple Tasks could be easily solved in one Transform, with far better logic management and control.

andybuchanan
Contributor ⭐️⭐️⭐️⭐️
August 16, 2023

I have a similar use case, trying to simply actions / steps in a rule chain.  Either requires more transformations, or more actions.  If I could use a case statement and choose a date field across multiple fields, then I could choose the right one for each relationship, and have a single field, which would allow a single action.

 

Andy
Expert ⭐️
August 16, 2023

This is not the right answer. But, a workaround I’ve done for when we want to fill in a date where one is greater than the other.

  1. Perform a date diff from your date fields and today, each date field gets a date diff.
  2. In next transformation perform a Case statement to determine which one has the highest date diff and output that number.
  3. In a 3rd transformation add that output number to a add date function.

 

In gets the job done. But does require more steps. Should be able to output in date still.

andybuchanan
Contributor ⭐️⭐️⭐️⭐️
August 16, 2023

Wayne, that is a good workaround for other use cases, but I am trying to standardize a rule across all my relationships (products).  I have one MDA object that stores all my product line item SKUs along with Account ID, each with different Term end dates.  

Pivoting off a SKU category allows me to easily create a date Max end date field for each product.  From there I can simply merge with the relationship off the Account ID.  If I could do a case statement on the Relationship Name (all or relationship names are consistent and named “<<Product Name>>” then I could build out a case statement to determine which field date I should populate the relationship with dynamically and it’s simply one action step, not 1 for every product I have.

Without this, the rule doesn’t scale well as more products are added, more actions /  steps are needed.

Andy
bradley
Expert ⭐️
August 26, 2025

It’s 2025 and we still don’t have more data type options with Case statements.

@revathimenon can we get some consolidation here, and maybe a PM to weigh in on any progress made on this in the last 4+ years and if it is anywhere on the horizon? Thanks!