Parsing an array variable to an array does not work

Oct 20, 2017
I have array m filled with many rows in 2 columns. I want to compare a string with the content of each row in the first column. That works without any problem. I build a DO-loop to increment the row number and inside the loop I compare the string with the content of the first column in each row:
(%r = row number)
(%m = array m)

DO r = 0 TO %@DEC[%@arrayinfo[m,1]] BY 1 IFF %@WILD["%string%",*%m[%r%,0]*] == 1 THEN ECHO Found ELSE Echo Not found ENDIFF ENDDO

This DO-loop works perfect. Now, I have 2 arrays: array m and t and I want to compare a string with the first column in each row of each array. I build a second DO-loop around the first DO-loop:
(%a = array)
(%r = row number)

DO a IN /L t m DO r = 0 TO %@DEC[%@arrayinfo[%a,1]] BY 1 IFF %@WILD["%string%",*%%a[%r%,0]*] == 1 THEN ECHO Found ELSE Echo Not found ENDIFF ENDDO ENDDO

Variable a become “t” but the parsing does not work. I experimented with more % signs, but I can’t get it to work.
May 20, 2008
Syracuse, NY, USA
In a nutshell ...

v:\> setarray a[2] & set a[0]=TRUE & set a[1]=FALSE

v:\> set arrayname=a

v:\> echo %[arrayname[0]]

v:\> echo %[arrayname[1]]
Oct 20, 2017
Thanks Vefatica for your input.
I couldn't get the code working:
IFF %@WILD["%string%",*%[a[%r%,0]]*] == 1 THEN
I'll build a test programm to understand the difficulty.
May 20, 2008
Syracuse, NY, USA
I don't know. This seems to work.

v:\> setarray a[4,2]

v:\> set a[0,0]=? & set a[1,0]=?? & set a[2,0]=??? & set a[3,0]=????

v:\> set string=xxxx

v:\> do name in /L a ( do row=0 to 3 ( if %@wild[%string,%[name[%row,0]]] == 1 echo YES (row %row) ))
YES (row 3)
Oct 20, 2017
Thanks Vetatica,

I have build a test.btm with:
IFF %@WILD["%string%",*%[a[%r%,0]]*] == 1 THEN
It ran without any problem.
I applied the same fix to my batchfile again and it worked this time without any problem.
So, the bug disappeared. Must be programmerdfailure.
Similar threads
Thread starter Title Forum Replies Date
vefatica IF, @WMI, parsing? Support 7
M Command line parsing differences between cmd.exe and TCC Support 6
nickles Command name parsing of GNU compilers Support 13
J Python: TCC command line parsing removes '=' equal sign characters Support 4
H command line parsing question Support 5
cgunhouse One of the Focuses of V17 Beta Testing Should Be Command Line Parsing Support 1
M How to? Parsing lines containing double quotes... Support 3
Stefano Piccardi parsing issue in command GLOBAL Support 3
C CMD if parsing Support 2
M A probably stupid question about .btm file argument parsing... Support 6
S New "home" variable parsing issue Support 1
samintz Help with some parsing Support 6
vefatica Parsing error! Support 9
nikbackm Parsing problem? (IFF, "", &) Support 0
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
vefatica SET /A and multidimensional array. Support 1
vefatica Array name in a variable? Support 3
J WAD "setarray /f" only overwrites the first array var Support 2
J How to? Array sort according to multiple keys Support 3
S Documentation "DEFINED" vs. array elements Support 1
Frank watch an array variable in ide/bdebugger Support 2
S WAD SET problem - array element initialization Support 11
C Simple .bat question - dump contents of 2 dimensional array Support 2
Charles Dye Array limits Support 8
S How to access array elements? Support 5
S ARRAY enhancements Support 0
vefatica Leading spaces in array variables Support 13
A What is the fastest way to dump a array Support 4
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
P Inserting string into a variable. Support 3
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
R Difference between TCC and CMD: variable names with hyphens Support 4
Joe Caverly Get a variable type Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
rps For loop internal %_for_files variable? Support 2
A How to safely print variable's value without quotes? Support 9
nikbackm TCC 20 variable expansion bug Support 6
X How to set %_INIREAD result to variable Support 5
Charles Dye _USBS variable Support 2
BeechComer Debugger: how to set %1 variable? Support 3
Mordachai Variable followed by function constantly failing... Support 5
T Variable indirection for arrays Support 1
Mike Hall Unexpected "Variable loop" in IF condition Support 10
vefatica If there's no PATH variable ... Support 5
C Maximum length for a variable Support 8
D WAD Internal variable _cpu is undefined Support 2
fpefpe How to? Global variable set /v Support 4
I Change value of a variable while debugging Support 3
I "IF" command in a variable does not expand redirection variable name Support 0
J Variable setting regression in tcc17 ? Support 5

Similar threads