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

Text Formula is Null in Group summary

Status
Not open for further replies.

lauriesamh

Technical User
Sep 1, 2004
119
US
I'm using CR8.5.
I have a formula (@Name) to put a person's first, MI and last name together in the Group Header for the person's ID.

The @Name is a Summary (Maximum) of @Name in the detail record as there are occasions when two ID's are used for a person and their dependant.

Occasionally a person has no Middle Initial which causes Summary of @Name to be blank in the Group header. I tried to go around this with a second formula @MiddleInitial with no luck. Any ideas to do a maximum summary on a text formula?

@Name
{TableName.First}&" "&{@MiddleInitial}&" "&{TableName.Last}

@MiddleInitial
WhilePrintingRecords;
StringVar MiddleName:="";

If IsNull ({TableName.Middle}) then MiddleName:="" else
MiddleName:={TableName.Middle};
 
You don't need to use a variable for middle name. Try:

If IsNull ({TableName.Middle}) then "" else
{TableName.Middle}

Then your first formula should work except you will have an extra space. You might want to eliminate the second space and change {@middlename} to:

If IsNull ({TableName.Middle}) then "" else
{TableName.Middle}+" "

-LB
 
Since my names are in one name file, here's a standard I use whenever I have a need for a Name in a report.

Code:
//Last, First Middle from MASTER_NAMES

stringvar n;

if isnull({MASTER_NAMES.LNAME}) then
    n := "Unknown"
else
    n := {MASTER_NAMES.LNAME};
if isnull({MASTER_NAMES.FNAME}) then
    n := n & ", Unknown"
else
    n := n & ", " & {MASTER_NAMES.FNAME};
if isnull({MASTER_NAMES.MNAME}) then
    n := n
else 
    n := n & " " & {MASTER_NAMES.MNAME};
n
 
Wow you guys are fantastic! Thanks for the quick response!!!!

LBass actually provided the best solution for my needs, but thank you both!
 
You are welcome!

Similarly, I use basically the same process when creating an address where I could have blanks in any one of the fields

Street_Number
Street_Direction
Street_Name
Street_Type
Street_Direction2
Apt_Number
City
State
ZIP

123 S 31st St S #123 AnyCity, KS 12345-1234

Cheers,
-LW
 
I see no use of a maximum in your formula, so the solution doesn't seem to address the issue of the maximum.

You might try:
iif(isnull({table.middlename},{table.firstname}&" "&{table.lastname},{table.middlename},{table.firstname}&" "&{table.middlename}&" "&{table.lastname})

Generally if numerous names are used in a table there's a datestamp which identifies the most recent, a maximum will not assure that you have the latest unless you have a date stamp, and names can change over time as a result of marriage, etc.

-k
 
Not sure about lauriesamh but in my database, I've already performed a record selection of primary name ({Type="P"). All other names for the same person are considered Aliases ({Type}="A") in which case I have Master_Names_1 alias table for alias names.

-LW
 
Thanks again for all your input.

LW - we don't have Aliases in our Database at present. But thanks for the info!

synapsevampire - Thanks for the other solution!

All - have a great day.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top