Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number field "If then else" 1

Status
Not open for further replies.

kenp705

Technical User
Jul 7, 2006
15
US
I am using CR 11 and am having a problem with a number field. I have a number field containing 4 digit numbers, eg. 2500, 2650, etc... I need a formula that will look at the number field and label each number that does not end with 00 as Private. Can I do this with an "If then" statement?? Thanks for any help.
 
kenp705,

try:

stringvar val := totext({table.field},0,"");
if right(val,2) = "00" then
val
else
"Private"

Andy
 
Thank you Andy, there is only one thing that I forgot to mention. Some of the values in the number field are 0 and I don't want them to be Private. Your solution works great except for the 0's. Can I modify it so that the 0' are not labeled as Private? Thank you very much.....
 
I may not understand what you are needing.

It would show 2650 as "Private" and 2500 as "2500". What would you rather it did?

Andy
 
I have a field with street addresses. Anything that has an address which is a private property address will be 2650 N Josey Ln for example. A public roadway address will end with 00 such as 2600 block of Josey Ln. I am looking for a way to auto label addresses as public or private. What I had done was to use the Val command which returns the first numeric part of the address. But some of them are intersections such as Beltline Rd/Josey Ln. The intersections return a 0 from the Val command. I am sure there is a better way to do this. There are some exceptions such as 2500 35E North, which gives 250035 from the Val command. So I may be on the wrong track. Thanks again for your help....
 
Would "Beltline Rd/Josey Ln" be public or private?

Try:

stringvar array strng := split({table.field}," ");
If val(strng[1]) = 0 then
{table.field} & "Public or Private"
else if right(strng[1],2) = "00" then
{table.field} & "Public"
else
{table.field} & "Private"

Andy
 
You are an absolute GURU!!! That formula works fantastic. I have a long way to go in learning Crystal. Thank you....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top