Select to view content in your preferred language

Calculate a text based on Date field entered

590
2
Jump to solution
10-15-2024 09:51 PM
AbdulabnanMohammed
Occasional Contributor

Hi @IsmaelChivite & Experts

I would like to include in between the date from and to and I have Applied a logic by going through your idea but it fails when i choose 27th feb 2026 then spring should be populated but it is considering winter
I have attached the XLS, Need  Guidance how to correct or what i missed

I shall be thankful 

WinterWinterFrom 11 Nov to 19 Feb.
SpringSpringFrom 20 Feb. to 20 May
SummerSummerFrom 21 May to 14 Aug
AutumnAutumnFrom 15 Aug. to 10 Nov
0 Kudos
1 Solution

Accepted Solutions
JenniferAcunto
Esri Regular Contributor

Your calculation is based on the month, but the value you are using is month + day. 427 is greater than 11, so that is why you are getting Winter. 

Also, the order of your if statements matter. Survey will stop at the very first statement that is true. If todays_monthday is equal to 6, it will return Spring because 6 is greater than 2 so it stops checking the rest of the calculation. It doesn't even know there is an option to check and see if it is greater than 5. 

if(${todays_monthday}>11,'Winter',if(${todays_monthday}>2,'Spring',if(${todays_monthday}>5,'Summer',if(${todays_monthday}>6,'Spring','Winter'))))

 

With those things in mind, the following should work for what you want. 

 

if(${todays_monthday}>1111,'Winter',if(${todays_monthday}>815,'Autumn',if(${todays_monthday}>521,'Summer',if(${todays_monthday}>220,'Spring','Winter'))))

 

- Jen

View solution in original post

0 Kudos
2 Replies
JenniferAcunto
Esri Regular Contributor

Your calculation is based on the month, but the value you are using is month + day. 427 is greater than 11, so that is why you are getting Winter. 

Also, the order of your if statements matter. Survey will stop at the very first statement that is true. If todays_monthday is equal to 6, it will return Spring because 6 is greater than 2 so it stops checking the rest of the calculation. It doesn't even know there is an option to check and see if it is greater than 5. 

if(${todays_monthday}>11,'Winter',if(${todays_monthday}>2,'Spring',if(${todays_monthday}>5,'Summer',if(${todays_monthday}>6,'Spring','Winter'))))

 

With those things in mind, the following should work for what you want. 

 

if(${todays_monthday}>1111,'Winter',if(${todays_monthday}>815,'Autumn',if(${todays_monthday}>521,'Summer',if(${todays_monthday}>220,'Spring','Winter'))))

 

- Jen
0 Kudos
AbdulabnanMohammed
Occasional Contributor

@JenniferAcunto 

Thank for your response

 

0 Kudos