× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 22 Feb 2013 10:24, DeLong, Eric wrote:
<<SNIP>>

Even this would have issues if theSalutation was blank... The
correction for that is another %trim, unfortunately...

myString += %trim( %trim( theSalutation ) + ' ' +
%trim( theFirstName ) + ' ' +
%trim( theLastName ) );

We NEVER want to ASSUME that blanks in data fields will be
consistent...


FWiW: Perhaps the data could come from a SQL database TABLE or VIEW and the assumption is made instead, that the database has ensured the data is consistent, to reduce some coding in the application programs:

[code]

create table theTable
( theSalutation varchar(xx)
, theFirstName varchar(yy)
, theLastName varchar(zz) not null
, constraint SalutationOrFirstName check( theSalutation is not NULL or theFirstName is not NULL )
, constraint SalutationUntrimmed check( length(theSalutation)=length(trim(theSalutation)))
, constraint FirstNameUntrimmed check( length(theFirstName)=length(trim(theFirstName)))
, constraint LastNameUntrimmed check( length(theLastName)=length(trim(theLastName))) )
; -- Table THETABLE created
insert into theTable values
('Mr.', 'Eric', 'DeLong')
,(default, 'Eric','DeLong')
,('Mr.', default, 'DeLong')
; -- 3 rows inserted in THETABLE
insert into thetable(thelastname) values('DeLong')
; -- INSERT or UPDATE not allowed by CHECK constraint SALUTATIONORFIRSTNAME.
insert into theTable values('Mr. ', 'Eric', 'DeLong')
; -- INSERT or UPDATE not allowed by CHECK constraint SALUTATIONUNTRIMMED.
select /* likely has value encapsulated in a CREATE VIEW */
ifnull( theSalutation concat ' ', '' ) concat
ifnull( theFirstName concat ' ', '' ) concat theLastName
from theTable
; -- report follows
String Expression
Mr. Eric DeLong
Eric DeLong
Mr. DeLong
******** End of data ********

[/code]


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.