You did not say where in the string the first name begins, so I cannot help you. I need to know where it begins, and what happens if you have a very short last name like "Woo"? Does the first name begin at character # 4 ? Or is it padded with X number of spaces?
Please advise Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
So there is not consistency to the first and last names? It is possible to test for the existence of a comma or a space and separate the string -- this is done with the Instr() function -- but I know of no way to separate the string if there is nothing to indicate where the separation is.
Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
The only way to separate them the way you have shown us is if we are garuanteed that the first name begins with a capital letter...we can find that.
Is the reason for the mandatory 20 chars of Last name + 5 chars of spaces so that the First names line up?? This won't happen unless you use a courier font. I would recommend a formula field then 2 display fields...then there is no alignment problem
//start test at second char for the first capital
for i := 2 to Length(temp) do
(
if asc(temp) in [65 to 90] then
(
if i > 20 then
firstName := temp[1 to 20]
else
firstName := temp[1 to i-1];
if length(temp) - i + 1 > 15 then
lastName := temp[i to i+14]
else
lastName := temp[i to length(temp)];
exit for;
);
);
//do something if there are no capitals
if firstName := "" then
(
firstName := left(temp,20);
lastName := right(temp,15);
);
put all 3 formulas in the detail section but suppress the
@GetLastnameFirstname formula and space the other 2 display formulas appropriately.
This is the best I can do...even then this formula won't handle hyphenated lastnames...I suppose it could if I tested for them...then ignored the next capital letter...but I'll let you figure that out
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.