ppchong
10th August 2009, 11:32
Dear Sir / Madam,

Currently i have done some baan coding. I do not quite understand the "string.scan" command. My coding is as below :


DscaTmp = "ABC wellcome to testing123456"

i = 0
n = 0

REPEAT
Dsca1 = ""
Dsca2 = ""

string.scan(DscaTmp, "%s %s", Dsca1, Dsca2)

i = i + 1
n = n + 1

Desc(1, i) = Dsca1
DscaTmp = Dsca2

UNTIL ISSPACE(Dsca2)


May i know what is the value for variable i,n, Dsca1 and Dsca2 ?

Anyone can help ?

Your Advise is greatly appreciated.

Thank you

mark_h
10th August 2009, 16:16
This is the correct forum for questions on development. The other forum is for sharing code you developed.

string.scan parses the input a string based off the separator character. So in this case if you use string.scan(DscaTmp, "%s %s", Dsca1, Dsca2) then dsca1 contains ABS and dcsa2 contains the rest of the string. Typically I use string.scan to read in pipe delimited or comma delimited files .

manish_patel
11th August 2009, 08:02
You can use Baan debugger (http://www.baanboard.com/programmers_manual_baanerp_help_debugger_the_baan_debugger) to test the execution of a program. To execute program in debug mode compiled script with the debug option.

Value of the variable after executing string.scan()

i = 1, n = 1
Dsca1 = "ABC"
Dsca2 = "wellcome to testing123456"

i = 2, n = 2
Dsca1 = "wellcome"
Dsca2 = "to testing123456"

i = 3, n = 3
Dsca1 = "to"
Dsca2 = "testing123456"

i = 4, n = 4
Dsca1 = "testing123456"
Dsca2 = ""

ppchong
11th August 2009, 09:10
thks Manish