cancel
Showing results for 
Search instead for 
Did you mean: 

If then else problem

Former Member
0 Kudos

Hello,

This code snippet never returns the actual LName value.

The LName value that is returned is always NULL.

local stringvar LName := trim({Employee.Last_Name});

local stringvar FName := trim({Employee.First_Name});

if (FName NOT EQUAL "") then

FName

else

LName;

TIA,

Jacques

Accepted Solutions (1)

Accepted Solutions (1)

ido_millet
Active Contributor
0 Kudos

If what you are trying to do is access Lname outside that formula, you must declare that variable as Global (not Local).

Former Member
0 Kudos

Hello,

Thank you for your reply

.

However, the problem exists with or without

the local variables.

The First_Name value is returned, but the

Last_Name value is always NULL.

WhilePrintingRecords;

if {Employee.First_Name} = "" then

{Employee.Last_Name}

else

{Employee.First_Name};

What is wrong with the syntax/logic?

-jc

ido_millet
Active Contributor
0 Kudos

Please clarify your question.

Former Member
0 Kudos

Hello,

Thank you for your reply

The First_Name value is returned, but the

Last_Name value is always NULL.

WhilePrintingRecords;

if {Employee.First_Name} = "" then

{Employee.Last_Name}

else

{Employee.First_Name};

When the First _Name is empty, the

formula should display the Last_Name.

However, the Last_Name value that is returned

is always NULL. The Last_Name vallues should

be "Smith", "Jones",,

Why does the formula always return NULL for

the Last_Name?,

-jc

ido_millet
Active Contributor
0 Kudos

I still find it hard to understand the question. The formula doesn't return Last Name. What do you mean by "returns Null for last name"?

Former Member
0 Kudos

Hello,

Thank you for your reply

WhilePrintingRecords;

if {Employee.First_Name} = "" then

"Smith"

else

"Jones"

When the First_Name is empty,

the string "Smith" should be displayed

on the report. Instead of displaying

the string "Smith" the report is blank.

-jc

ido_millet
Active Contributor
0 Kudos

Use IF IsNull(...)

Former Member
0 Kudos

Hello,

Yes, that worked!

Thanks.

Answers (0)