Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test for ! empty fails
Message
From
18/08/2016 17:43:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01639633
Message ID:
01639665
Views:
61
>Hi everybody,
>
>I have this simple code
>
>
>replace dc_crdno WITH REPLICATE("*",12) + RIGHT(ALLTRIM(dc_crdno),4) FOR NOT EMPTY(dc_crdno) && IN csrReport
>
>The problem is that I see just 12 * for some rows, so I assume that there may be some unprintable characters in that column. How can I make sure to either show 12* + 4 last digits or show empty value?

Just to eliminate the obvious nonsense... are you sure that this column is c(16) at least?

Since your command here is destructive, I assume it's running on a cursor which originally had 16 digit card numbers, probably coming from some previous select.

1) make sure that the field is made as select ...(cast dc_crdno as c(16)) as dc_crdno, so that we're sure it's not Fox measuring the first row and deciding from it how wide the column should be.

2) How about

replace dc_crdno with stuff(dc_crdno, 1, 12, replcate("*",12)) for chrtran(dc_crdno, "0123456789", "##########")=replicate("#", 16)

Not saying that this is in any way faster (surely not, with replicate() being called for each row - should put those into variables), but this should hit only 16 digit card numbers - and if you see anything else, well, then the suspicions about unwanted characters may be justified, and investigated.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform