PDA

View Full Version : Why do I have to 'trim' all the time ?



DavePorter
17-Feb-2005, 07:32 AM
Hi Everyone,

Just a small annoyance, but If I set a default in a form like so:

If (Found) Set value of FromAccountsCode item 0 to (trim(accounts.code))

If I don't trim I get ugly spaces after the value.

Why is it so ?
Clearly the spaces are not stored in the database!

cheers, Dave Porter

Steve Kusnerus
17-Feb-2005, 07:44 AM
Dave Porter wrote:

> Clearly the spaces are not stored in the database!

Actually, they are. :-) In the native DF database, all Ascii fields are padded to their full length with spaces.

-Steve

DavePorter
17-Feb-2005, 07:52 AM
Thanks Steve,

So I I wanted to store 'Dave " in a field I Couldn't ?
Not that I've ever wanted to ( or likely to ! ) :)))
cheers, Dave


Steve Kusnerus wrote:
> Dave Porter wrote:
>
>
>>Clearly the spaces are not stored in the database!
>
>
> Actually, they are. :-) In the native DF database, all Ascii fields are padded to their full length with spaces.
>
> -Steve
>
>

Michel Boisvert
17-Feb-2005, 07:56 AM
Your point make sense Dave,

we too have to always trim values when filling objects values. Spaces add
nothing since fields are filled anyway when they are saved.. There is no
reasons for trailing spaces not being truncated automatically. That would
remove a lot of trimming in our codes!

Michel



"Dave Porter" <dave@dj-software.com.au> a écrit dans le message de news:
DGim3yOFFHA.4864@dacmail.dataaccess.com...
>
> Hi Everyone,
>
> Just a small annoyance, but If I set a default in a form like so:
>
> If (Found) Set value of FromAccountsCode item 0 to (trim(accounts.code))
>
> If I don't trim I get ugly spaces after the value.
>
> Why is it so ?
> Clearly the spaces are not stored in the database!
>
> cheers, Dave Porter

DavePorter
17-Feb-2005, 08:28 AM
Hi Michael,

That is my point precicely - I seem to be typing a lot of 'trims' :)))
cheers, Dave


Michel Boisvert wrote:
> Your point make sense Dave,
>
> we too have to always trim values when filling objects values. Spaces add
> nothing since fields are filled anyway when they are saved.. There is no
> reasons for trailing spaces not being truncated automatically. That would
> remove a lot of trimming in our codes!
>
> Michel
>
>
>
> "Dave Porter" <dave@dj-software.com.au> a écrit dans le message de news:
> DGim3yOFFHA.4864@dacmail.dataaccess.com...
>
>>Hi Everyone,
>>
>>Just a small annoyance, but If I set a default in a form like so:
>>
>>If (Found) Set value of FromAccountsCode item 0 to (trim(accounts.code))
>>
>>If I don't trim I get ugly spaces after the value.
>>
>>Why is it so ?
>>Clearly the spaces are not stored in the database!
>>
>>cheers, Dave Porter
>
>
>

Steve Kusnerus
17-Feb-2005, 08:37 AM
I agree, I wouldn't want to store "Dave " in a field, either. :-)

But seriously, I think the only way you can store trailing spaces would be to a text field. IIRC, trailing spaces only get stripped by DF/VDF when DEO's are populated, and I think certain types of comparisons. Perhaps someone else could elucidate?

I've pretty much learned over the past 20 years to always do a trim or rtrim when working with ascii database fields.

-Steve



Dave Porter wrote:

> Thanks Steve,
>
> So I I wanted to store 'Dave " in a field I Couldn't ?
> Not that I've ever wanted to ( or likely to ! ) :)))
> cheers, Dave
>
> Steve Kusnerus wrote:
> > Dave Porter wrote:
> >
> >
> >>Clearly the spaces are not stored in the database!
> >
> >
> > Actually, they are. :-) In the native DF database, all Ascii fields are padded to their full length with spaces.
> >
> > -Steve
> >
> >

Larry Heiges
17-Feb-2005, 03:06 PM
Before functions, you just used the TRIM command instead of MOVE so
there was no added programming overhead.


Larry Heiges
App-2-Win Systems, Inc.
LookFeel for Windows
http://app-2-win.com
LFW7sp3
LFW9.1
LFW10
working on LFWeb

Peager
17-Feb-2005, 04:11 PM
Larry,

The use of most of the old string commands has been depreciated in favor of
the new functions. (You will see them flagged obsolete in the docs.)

Paul

--
Paul E. Richmond
IS Project Leader
L.D. McFarland Co.
(253) 572-3033
"Larry Heiges" <lheiges@app-2-win.com> wrote in message
news:tpt911ts2g59r78a7dmfbvs6bbikrahfc5@4ax.com...
>
> Before functions, you just used the TRIM command instead of MOVE so
> there was no added programming overhead.
>
>
> Larry Heiges
> App-2-Win Systems, Inc.
> LookFeel for Windows
> http://app-2-win.com
> LFW7sp3
> LFW9.1
> LFW10
> working on LFWeb

Larry Heiges
17-Feb-2005, 04:37 PM
Paul,

Yea I know... but from a coding point of view, historically there
would not have been a need to do an "auto trim" as suggested by the
topic.

Larry Heiges
App-2-Win Systems, Inc.
LookFeel for Windows
http://app-2-win.com
LFW7sp3
LFW9.1
LFW10
working on LFWeb

Larry Heiges
18-Feb-2005, 02:26 PM
Dave,

Auto trimming is always dangerous, rtrim less so.

An example would be the standard way Codemast is returned to a combo.
It is trimmed instead of rtrimmed, so you can not have a code with
leading spaces, which is handy for correct ordering in a combo.

Larry Heiges
App-2-Win Systems, Inc.
LookFeel for Windows
http://app-2-win.com
LFW7sp3
LFW9.1
LFW10
working on LFWeb