Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ascan exact in select-sql
Message
From
30/12/2004 07:19:28
 
 
To
30/12/2004 05:59:09
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00973127
Message ID:
00973226
Views:
16
Fabio,

I changed the example a bit. All results are as expected with SET ANSI ON. They are weird if SET ANSI OFF. The REPLACE command always returns the correct result. Agree?
local array laTmp[5]
laTmp[1]='abc'
laTmp[2]='cde'
laTmp[3]='temx'
laTmp[4]='tem'
laTmp[5]=''
acopy( laTmp, laTmpX )
dimension laTmpX[ 6 ]
ains( laTmpX, 1 )
laTmpX[1] = '-'

create cursor c_tmp ( pk I,cString c(4), OFFOFF c(4), OFFON c(4), ONOFF c(4), ONON c(4) )
insert into c_tmp values (1, 'abc ','','','','' )
insert into c_tmp values (2, 'tem ','','','','' )
insert into c_tmp values (3, ''    ,'','','','' )
insert into c_tmp values (4, 'xxx ','','','','' )

SET ANSI OFF
SET EXACT OFF
*REPLACE ALL OFFOFF WITH laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]
UPDATE c_tmp SET OFFOFF=laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]

SET ANSI OFF
SET EXACT ON
*REPLACE ALL OFFON WITH laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]
UPDATE c_tmp SET OFFON=laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]

SET ANSI ON
SET EXACT OFF
*REPLACE ALL ONOFF WITH laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]
UPDATE c_tmp SET ONOFF=laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]

SET ANSI ON
SET EXACT ON
*REPLACE ALL ONON WITH laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]
UPDATE c_tmp SET ONON=laTmpX[ 1 + ascan( laTmp, rtrim( cString ), -1, -1, 0, 7 )]

LOCATE
browse LAST NOWAIT
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform