Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Changing presence based on value of another calculated field

sm38240
Level 1
Level 1

Hi,

I am trying to hide a signature field if the value of another calculated field is less than a certain value.  I am attempting to use:

 

if (TotalRelUpper.rawValue<150) then

signature.presence="invisible"

endif

If I put this formcalc statement in the click section of the calculated field, the signature field presence will change state, but I want it to automatically change state based on the calculated value.

Ideas appreciated.

Thanks!

7 Replies
Srini_Dhulipall
Level 10
Level 10

Did you try placing the code in the Calculate event of the field?

Thanks

Srini

sm38240
Level 1
Level 1

Srini,

Thanks for the info.  When I place the following code in the calculate section, the calculation does not work.  The signature field is invisible and no value will make it visible.

Thanks,

Stan

 

form1.#subform[0].TotalRelUpper::calculate - (FormCalc, client)

 

 

TotalRelUpper.rawValue=UpperNFC.rawValue+UpperExp.rawValue

 

if (TotalRelUpper.rawValue<150) then

VPsignature.presence="invisible"

endif

Srini_Dhulipall
Level 10
Level 10

Stan,

     You are missing the else part in the code..

  

TotalRelUpper.rawValue=UpperNFC.rawValue+UpperExp.rawValue

 

if (TotalRelUpper.rawValue<150) then

     VPsignature.presence="invisible" 

else    

     VPsignature.presence="visible"

endif

Thanks

Srini

sm38240
Level 1
Level 1

Srini,

Even with the else statement, the code does not work in the calculate section.

form1.#subform[0].TotalRelUpper::calculate - (FormCalc, client)

TotalRelUpper.rawValue=UpperNFC.rawValue+UpperExp.rawValue

if  (TotalRelUpper.rawValue>150)then

    VPsignature.presence="visible"

else

    VPsignature.presence="invisible"   

endif

The calculated field is read only and is the sum of two other fields filled in by the user.  I want to have a signature field appear or disappear based on the value in the calculated field.

Thanks,

Stan

whyisthisme
Level 7
Level 7

try putting it in the layoutReady event

sm38240
Level 1
Level 1

Thanks for the suggestion.  I tried placing the code in several of the layoutready events, to no avail.  There has to be a simple solution, but as a novice in form building, it eludes me.  Other inputs are welcome.

Thanks

_Bruce_Robertson
Level 10
Level 10

Hi Stan,

You just need to make sure the last expression evaluated to the calculate event it the one you want in the result, so you can do;

TotalRelUpper.rawValue=UpperNFC.rawValue+UpperExp.rawValue

if  (TotalRelUpper.rawValue>150)then

    VPsignature.presence="visible"

else

    VPsignature.presence="invisible"   

endif

TotalRelUpper.rawValue

The last line can set there like that, or you could do;

var total=UpperNFC.rawValue+UpperExp.rawValue

if  (total>150)then

    VPsignature.presence="visible"

else

    VPsignature.presence="invisible"   

endif

TotalRelUpper.rawValue=total

Regards

Bruce