Jump to content
We've recently updated our Privacy Statement, available here ×

IF() used in a field


Bob.Lawson

Recommended Posts

I am trying to use IF() when building an address string but keep running into a ClassNotFound error.

$F{site_name}+"n"+		$F{site_address1}+"n"+		IF($F{site_address2}.length()>0,$F{site_address2}+"n","")+		$F{site_city}+", "+$F{site_state}+", "+$F{site_zip}[/code]

I have tried many things but I can not seem to run it with the IF() included. I have checked all the fields and the above prints fine if I do not have the IF().

Ideas?

Thanks

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I think, you cannot use an IF()...

Even if you could, you've used the if clause wrong.

It should look like this:

if(Field.length > 0){  Field_Side_Address2 + "n"} + the Rest...[/code]

 

 

You could try sth. like this:

$F{site_name}+"n"+ $F{site_adress1}+"n"+($F{site_address2}.length() > 0? $F{site_address2}+"n":"")+$F{site_city}+", "+$F{site_state}+", "+$F{site_zip}[/code]

The princip:

x > y ?  here_the_commands_if_true : here_the_commands_if_false[/code]

And don't forget the Clips! If you forget them, teh compiler uses the rest for the clause to

 

You can make a breakline with this "command": "<br>"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...