Expand my Community achievements bar.

SOLVED

Field visible based on Month

Avatar

Former Community Member

I have a club membership application form I am creating. I want to permit a membership discount of 10% if it is the months of April thru October,

I have set up a field that does that calculation (currently visible and active in the calculation stream below it). I want that field to disappear from the user's view and have that calculation go dormant from November 1 thru March 31, or the months of November thru March.

I have been using FormCalc. Any ideas?

Gordon

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can try the following code in the Initialize event..

if(Num2Date(Date(),"M") >3 and Num2Date(Date(),"M") <11) then
     //Write the code meant for Apr - Oct time frame
     DiscountField.presence= "visible";
else
     //Write the code for Nov- Mar time frame
     DiscountField.presence= "hidden";
endif

Similarly, you can use the same if condition in the calculation code for the discount..

Thanks

Srini

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

You can try the following code in the Initialize event..

if(Num2Date(Date(),"M") >3 and Num2Date(Date(),"M") <11) then
     //Write the code meant for Apr - Oct time frame
     DiscountField.presence= "visible";
else
     //Write the code for Nov- Mar time frame
     DiscountField.presence= "hidden";
endif

Similarly, you can use the same if condition in the calculation code for the discount..

Thanks

Srini

Avatar

Former Community Member

Thanks so much, your code was absolutely correct. As someone who learned programming in Fortran almost 40 years ago, the nuances of modern languages , like Java, can sometimes escape me. To me the FormCalc documentation wasnt exactly clear to me either. I was making it more complicated than it needed to be. Call me a relic. Thanks again