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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping

Status
Not open for further replies.

olushow

MIS
Joined
Jul 26, 2006
Messages
84
Location
US
I am having the following problem.

Company - Company A Company - Company B

Org - Org A Org -Org B

Dept - Dept A Dept - NULL

I created the following formula to group certain data with a concatenation of Company + " - " + Organization
It works for when there is a value in the Dept, but not when the Dept has a null value. I have tried different scenarios, Bt I can't get the concatenation to work, where the DEPT value is null.. My formula is listed below:

{HPD_Help_Desk.Company} = "Company Name"
and

not

isnull({HPD_Help_Desk.Organization})
and

isnull({HPD_Help_Desk.Department})

or

isnull({HPD_Help_Desk.Department})Then
{HPD_Help_Desk.Company}+ " - " + {HPD_Help_Desk.Organization}


 
you need to do your null check before any other processing.


you could also use variables to collect & concatenate the data like this:
stringvar co;
stringvar or;
stringvar de;

IF isnull({HPD_Help_Desk.Company}) then co := " " else co := {HPD_Help_Desk.Company};
IF isnull({HPD_Help_Desk.Organization}) then or := " " else or := {HPD_Help_Desk.Organization};
IF isnull({HPD_Help_Desk.Department}) then de : = " " else de := {HPD_Help_Desk.Department};

TRIM(co&" - "&or&" - "&de)


you could use more complex logic in the final line to prevent there being a trailing hyphen if the de is null.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top