Skip to main content
Question

Updating script with specific dates

  • January 18, 2018
  • 0 replies
  • 49 views

How would I rewrite the script to account for both [Program approved] and [Permanently Rejected] fields to be specific for dates below? 

June2016 - May2017=2016

June2017 ? May2018=2017

June2018 ? May2019=2018

My current script is working but I need to account for 2018:

If([Customer - Utility]="ABC Energy" and (Date(2017,5,31)>=[Program approved] or Date(2017,5,31)>=[Permanently Rejected]),"2016","2017")

This topic has been closed for replies.

If(

[Customer - Utility]="ABC Energy" and (Date(2018,5,31)>=[Program approved] or Date(2018,5,31)>=[Permanently Rejected]), "2018",

[Customer - Utility]="ABC Energy" and (Date(2017,5,31)>=[Program approved] or Date(2017,5,31)>=[Permanently Rejected]), "2017", "2016")

My requirements have changed and know not dependent on Customer. 

So will the following still work if I write :

If(Date(2017,12,31)>=[Program approved] or Date(2017,12,31)>=[Permanently Rejected],"2018",

Date(2016,12,31)>=[Program approved] or Date(2016,12,31)>=[Permanently Rejected],"2016","2017")

Just curious if [Program approved] is blank/null does the formula think it is greater than 12.31.2017?

Thanks.

That looks like it will work,  but I don't think that the condition will be true if the dates are null.  Hence it will probably calculate to 2017.

I suggest that you specifically test for null dates and decide what you want to output for that situations.

IF(
IsNull([Program approved]) and Isnull([Permanently Rejected]), "say something",

Date(2017,12,31)>=[Program approved] or Date(2017,12,31)>=[Permanently Rejected],"2018",

Date(2016,12,31)>=[Program approved] or Date(2016,12,31)>=[Permanently Rejected],"2016","2017")

This is the logic I decided to use:

If(Date(2017,12,31)>=[Program approved] or Date(2017,12,31)>=[Permanently Rejected],"2018",
Date(2016,12,31)>=[Program approved] or Date(2016,12,31)>=[Permanently Rejected],"2016","2017")


But it is making everything "2018". I know I have about 400 records that should be "2018" currently.

  • Registered
  • January 25, 2018
I think this is what you want but I did not test it:

 var Date CriticalDate = Min([Program approved], [Permanently Rejected]);
 
 If($CriticalDate <= Date(2016,12,31), "2016",
    $CriticalDate <= Date(2017,12,31), "2017",
    $CriticalDate <= Date(2018,12,31), "2018",
    $CriticalDate <= Date(2019,12,31), "2019"
)