Expand my Community achievements bar.

FormCalc or Javascript when to use one over the other

Avatar

Former Community Member

I am working in Live Cycle Designer (version 8.2), FormCalc,  trying to determine how to get this to work:

if("GF_Exp_P">"GF_Exp_C")then

TextField4="Thumbs-Up"

else

TextField4="Thumbs-Down";

Endif

Actually what I want instead of the "thumbs up" "thumbs down" is instead an up arrow and a down arrow but I don't know if that can be done via FormCalc or if Javascript is needed.  If javascript is how I have to go, can someone assist me with that as well, I know ascii would probably be needed but I do not know how to incorporate this.

6 Replies

Avatar

Level 10

Hi,

A couple of things in relation to the FormCalc syntax:

  1. You would not wrap the references to objects in quotes. See here: http://assure.ly/mxZO9T.
  2. The test is "gt" for greater than (without the quotes).
  3. You do not need semi-colons at the end of lines (;).
  4. The endif does not have a capital "E".

So,

if (GF_Exp_P gt GF_Exp_C) then

     TextField4="Thumbs-Up"

else

     TextField4="Thumbs-Down"

endif

For the arrows you could use a Wingding font and pass through the appropriate character for the up/down arrow. You can see this in action in the script in the button of the last page in this example: http://assure.ly/g80MVY. 

Hope that helps,

Niall

Avatar

Former Community Member

Thanks for the reply, when you say I could use a Wingding font and pass through the appropriate character do you mean:

if

(GF_Exp_P gt GF_Exp_C) then

  TextField4="V"

else

  TextField4

="^"

Endif

I need to get some nice looking much bigger arrows to show up on this form as a result of the greater than less than, that is taking place.  What else can I easily do to accomplish this? 

Avatar

Level 10

If the textfield is only going to display the arrows, then I am suggesting that for that textfield you use Wingdings 3 font. This is a standard Windows font (afaik).

In my form the object font is set to Wingdings 3 and when I set the value to "t" or "q", it is displayed as block arrows.

Niall

Avatar

Former Community Member

Okay, I've set my Texfield4 to Wingdings3, then my formcalc code your saying should look like this:

if

(GF_Exp_P gt GF_Exp_C)then

TextField4

="t"

else

TextField4

="q";

endif

Avatar

Former Community Member

The form itself will have one field for the user to enter a previous years value (expenditures) and another field for them to enter current revenues, and the third field (which I am calling TextField4 at this point), will display either an up arrow or a down arrow depending on whether or not the number has increased or decreased.

Maybe this additional information will help you understand better what I'm trying to do.  The obvious is that I am not a programmer here :-)

Avatar

Level 10

Here is an example:

https://acrobat.com/#d=sc6WeIRiPMKwzwJs36C4KA

Have a look at the script in the textfield that shows the arrow.

Hope that helps,

Niall