DCGET with string array

This forum is for eXpress++ general support.
Post Reply
Message
Author
Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

DCGET with string array

#1 Post 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)
Klaus

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCGET with string array

#2 Post by Tom »

This does not work in Xbase++ anyway:

Code: Select all

c := "abc"
? c[2] // "b"
c[2] := "f"
? c // "abc"
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCGET with string array

#3 Post 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
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCGET with string array

#4 Post by Tom »

It works with LOCALs or STATICs:

Code: Select all

LOCAL c := 'abc'
c[2] := 'f'
? c // 'afc'
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCGET with string array

#5 Post by rdonnay »

That's interesting. I learned something new.
The eXpress train is coming - and it has more cars.

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

Re: DCGET with string array

#6 Post by Koverhage »

Tom, thank you.
Klaus

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCGET with string array

#7 Post by Tom »

:)
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply