IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#50478 - 12/23/14 12:14 PM If/and statements?
ontheroaderic Offline
OL Newbie

Registered: 03/04/10
Posts: 13
Loc: Lafayette, CO USA
I have a list where the there is FirstName1 LastName1, FirstName2 LastName2. I want to write an expression that returns:

If the last names are the same:
FirstName1 & FirstNam2 LastName1

If they are different:
FirstName1 LastName1
& FirstName2 LastName2

The problem is that sometimes there isn't a second name, so I can't just make a variable that compares LastName1 and LastName2 to see if they are different, it also has to account for the two being different and LastName2 not being blank . . . how would I accomplish this?

Top
#50480 - 12/23/14 12:46 PM Re: If/and statements? [Re: ontheroaderic]
ontheroaderic Offline
OL Newbie

Registered: 03/04/10
Posts: 13
Loc: Lafayette, CO USA
Figured it out! Can't see how to delete a post, so I thought I'd post my solution for future searchers.

I made two variables @name@ is:
IF([Lastname2] = [LASTNAME] AND [Lastname2] <> "", [FIRSTNAME] & " & " & [Firstname2] & " " & [LASTNAME], [FULLNAME])

and @name2dif@ is:
IF([Lastname2] <> "" AND [Lastname2] <> [LASTNAME], "& " & [Firstname2] & " " & [Lastname2], "")

And it behaves nicely!

Top