V2.39c $puts/$get failure


#1

The $puts/$get pair in the following Export script fails to behave as specced:

$loop(%_path%)Path #%_counter% %_directory%\\%_filename%
$loopend()------
$loop(%_directory%)$puts(side,%_counter%)$loop(%_filename%)Dir #$get(side) File #%_counter% 
$loopend()$loopend()

It should generate e.g.

Path #1 a\x
Path #2 b\y
Path #3 b\z
------
Dir #1 File #1 
Dir #2 File #1 
Dir #2 File #2

but generates

Path #1 a\x
Path #2 b\y
Path #3 b\z
------
Dir # File #1 
Dir #1 File #1 
Dir #1 File #2

If anyone can suggest a workaround for this script. I'd be grateful. Thanks.


#2

It seems to me that there is still a quirk in the export script language when using outside defined variables inside a loop() block.

Workaround for your case:
Change "Dir #$get(side)" to "Dir #$add($get(side),1)"

DD.20071105.0736.CET


#3

there is still a quirk in the export script language when using outside
defined variables inside a loop() block.

That's for sure!

Workaround for your case:
Change "Dir #$get(side)" to "Dir #$add($get(side),1)"

Thanks. The general-case workaround I've found is illustrated by this:

$loop(%_path%)Path #%_counter% %_parent_directory%\\%_directory%\\%_filename%
$loopend()------
$loop(%_parent_directory%)$loop(%_directory%)$puts(side,%_counter%)$loop(%_filename%)GPdir %_parent_directory% Dir $add($get(side),1) File #%_counter% 
$loopend()$loopend()$loopend()

failing thus:

Path #1 1\a\x
Path #2 1\b\y
Path #3 1\c\z
Path #4 2\a\x
Path #5 2\b\y
Path #6 2\c\z
------
GPdir 1 Dir 1 File #1 
GPdir 1 Dir 2 File #1 
GPdir 1 Dir 3 File #1 
GPdir 2 Dir 4 File #1 
GPdir 2 Dir 2 File #1 
GPdir 2 Dir 3 File #1

Here's the worked-around version:

$loop(%_path%)Path #%_counter% %_parent_directory%\\%_directory%\\%_filename%
$loopend()------
$loop(%_parent_directory%)$puts(side,0)$loop(%_directory%)$puts(side,%_counter%)$loop(%_filename%)GPdir %_parent_directory% Dir $add($get(side),1) File #%_counter% 
$loopend()$loopend()$loopend()

succeeding thus:

Path #1 1\a\x
Path #2 1\b\y
Path #3 1\c\z
Path #4 2\a\x
Path #5 2\b\y
Path #6 2\c\z
------
GPdir 1 Dir 1 File #1 
GPdir 1 Dir 2 File #1 
GPdir 1 Dir 3 File #1 
GPdir 2 Dir 1 File #1 
GPdir 2 Dir 2 File #1 
GPdir 2 Dir 3 File #1

#4

WARNING: both workarounds will break the script when the bug is fixed.