PDA

View Full Version : Formula - IF with a String & Interger



d.stairmand
2008-11-16, 11:28 PM
Guys
Im trying to make a formula that does this:

If (String A = "L", 0, 1) (returns a Integer Value)

Where "String A" = "L" (returns a Text Value)

It keeps on throwing the Error "Improper Use of Boolean Expression"

Scott Womack
2008-11-17, 11:15 AM
If (String A = "L", 0, 1) (returns a Integer Value)
Where "String A" = "L" (returns a Text Value)
It keeps on throwing the Error "Improper Use of Boolean Expression"

Strings are funny things inside of formulas. Try single quotes around the 'L". OR you may have to use ""L"". I've not actually tried what you are doing. I am assuming that String A is a parameter?

twiceroadsfool
2008-11-17, 01:15 PM
I dont believe you can use a text parameter inside the Boolean like that, you would need yo use a Yes/No, and write it as "If (String A, 0, 1)" i believe...

Calvn_Swing
2008-11-17, 07:57 PM
It is also very important to pay attention to the parameter type for both the target and the source parameters. Since they are limited to what they can display by the parameter type, a lot of formulas go bad when you pick the wrong type (or the one you thought was right).

A great example is that the parameter you're writing the formula in might be set to integer currently. But, since your formula is going to determine the actual value, why not just make it numeric or text since those are less restrictive in how they're used with formulas?

If possible, upload your family and let us give it a shot. It is hard to figure out exactly what you're doing just from the formula alone...

Thanks,

d.stairmand
2008-11-17, 10:07 PM
Here is the Family Guys
I have made up an Annotation Family that Turns on & Off the Filled Regions Depending on what Interger value you Type In, & adds these Interger up at the End. It all works Ok except for the First Line - It throws up a Graphic's Error on when i type in 0 - Both of the Filled Regions are turned on.

My Intent was to make a Text String that the User Could Type in L, M, H or VH, which would in Turn changes the Interger & Filled Regions to Suit.
If there is some other way to do this - Im all for it!

Calvn's Idea sounds good about leaving it a String (not an Interger)