How can I have multiple actions in one event?

Avatar

Avatar

jrob12488

Avatar

jrob12488

jrob12488

18-09-2015

I  have been trying to search this, but I just can't figure it out. I want to have two separate if then expressions execute on a calculate event. I can only ever get the first one to execute. I need to have a "Rush" box checkmarked if the difference between 2 days is less than 10. Then I also need to have the box change to visible if the box is checkmarked. Here is my code.

if (IsoDate2Num(ClosingDate) - IsoDate2Num(DateReq)<="10") then form1.FloodDet.Rush.rawValue=1 endif;

if (Rush.rawValue==1) then Reason.presence = "visible" else Reason.presence = "invisible" Reason.rawValue = " " endif;

Help me get this working pretty please!

I realize I could probably just put them on separate fields but I figured there HAS TO be a way to do it this way.

Replies

Avatar

Avatar

Magus069

MVP

Avatar

Magus069

MVP

Magus069
MVP

19-09-2015

Hi there,

you are mixing JavaScript with FormCalc, make sure to use only FormCalc

both if statement are wrong using formcalc

If the code above is still not working, try using Date2Num instead of IsoDate2Num, it basically does the same thing, I just never used IsoDate2Num

Always make sure to not put ";" at the end of statements, it is used as comments in FormCalc and end of line for JavaScript

Hope this help!

Avatar

Avatar

jrob12488

Avatar

jrob12488

jrob12488

21-09-2015

Yes, this definitely allowed me to put both of the If statements in the same event. Thank you! (I still have a lot to learn about the syntax of this stuff, I swore I had it right. I guess not )

One more question. Like I said, the "Rush" box will be automatically check marked if less than 10 days, then a "Reason for rush" box will open.

So for a while, I had each of these "IF" statements on separate fields. When I put the statement regarding visibility on the "reason for rush" field (calculate event) it shows the word "visible" in the text field. Any idea why this is happening? (see attached picture below.)

820514_pastedImage_0.png

Avatar

Avatar

Magus069

MVP

Avatar

Magus069

MVP

Magus069
MVP

21-09-2015

Calculate event is set to purpose of setting the value's field for the user.

So the last line of code in the calculate event is the value inserted in the field...

So depends on what code you have written, this is what it returns

Avatar

Avatar

jrob12488

Avatar

jrob12488

jrob12488

21-09-2015

Excellent! Thank you for your help. With both of these tips, I was able to solve both of my issues.

thanks!