Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00433677
Message ID:
00433689
Views:
11
>Why is it that this works:
>use table
>scatter memvar
>replace exceptions.username with "Closed Account " + m.username
>
>but when I do this
>
>replace exceptions.username with m.username + "Closed Account "
>
>I only get the m.username information?
>
>Thanks in advance for your help.

Say the username field is 12 characters long, but the current username is "BOB" - when you SCATTER it,
m.username = "BOB         "
- i.e., PADR("BOB",12)

So when you replace it, only first 12 characters get put in, since that's all that will fit.
Note that you'll also only get the first 12 characters if m.username is last in the expression - it may not appear so, however, unless m.username is long enough to be truncated.

You can do either of the following to join them regardless of righthand spaces:

REPLACE username WITH TRIM(m.username) + "Closed Account"

or

REPLACE username WITH m.username - "Closed Account"
Insanity: Doing the same thing over and over and expecting different results.
Previous
Reply
Map
View

Click here to load this message in the networking platform