Page 1 of 1
DCGET with string array
Posted: Thu Aug 13, 2015 3:05 am
by Koverhage
Why this does not work ?
cStatuscode := "NNNNNNNNNNNN"
DCGET cStatuscode[1] VALID {|| cStatuscode[1] $ 'YJN' }
DCGET cStatuscode[2] VALID {|| cStatuscode[2] $ 'YJN' }
...
up to 12
DCREAD
The content of cStatuscode ist not changed, no matter what i type (e.g. "J " at postion 6 and 7)
Re: DCGET with string array
Posted: Thu Aug 13, 2015 4:11 am
by Tom
This does not work in Xbase++ anyway:
Code: Select all
c := "abc"
? c[2] // "b"
c[2] := "f"
? c // "abc"
Re: DCGET with string array
Posted: Thu Aug 13, 2015 4:14 am
by Tom
Try this:
Code: Select all
cStatuscode := "NNNNNNNNNNNN"
aStatusCode := {}
FOR i := 1 TO Len(cStatusCode)
aAdd(aStatusCode,cStatusCode[i]
NEXT
DCGET aStatuscode[1] VALID {|| aStatuscode[1] $ 'YJN' }
DCGET aStatuscode[2] VALID {|| aStatuscode[2] $ 'YJN' }
...
DCREAD ...
cStatusCode := ""
FOR i := 1 TO Len(aStatusCode)
cStatusCode += aStatusCode[i]
NEXT
Re: DCGET with string array
Posted: Thu Aug 13, 2015 4:21 am
by Tom
It works with LOCALs or STATICs:
Code: Select all
LOCAL c := 'abc'
c[2] := 'f'
? c // 'afc'
Re: DCGET with string array
Posted: Thu Aug 13, 2015 5:31 am
by rdonnay
That's interesting. I learned something new.
Re: DCGET with string array
Posted: Thu Aug 13, 2015 5:47 am
by Koverhage
Tom, thank you.
Re: DCGET with string array
Posted: Thu Aug 13, 2015 6:08 am
by Tom