|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sat Sep 04, 2004 12:58 pm
Strange behavior with #forall and %db |
I'm working on a script for commodities trading, and I'm having difficulty displaying my record variables. Here's (a slightly trimmed version of) what I'm doing:
#VAR Comms {steel|wood}
#VAR CommsStock {}
#ADDKEY CommsStock steel 200
#ADDKEY CommsStock wood 150
#ALIAS tshow {#forall @Comms {#show %i...%db(@CommsStock, %i)}}
What I'm actually doing is a little fancier with the output and contains more commodities, but this is an illustration of something that I think is bugged. Inside of the #forall, the %db returns an empty string. Outside of the #forall, I get the number return that I expect. I've tried it with various combinations of quotes, braces, etc, to no avail. Anyone have any ideas? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Sep 04, 2004 1:08 pm |
#SHOWDB @CommsStock //simple show format
#SHOW %expanddb(@CommsStock,%crlf,": ") //userdefined output format
#loopdb @CommsStock {#show %key ... %value} //Can get really wicked with this one considering %key and %val are treated like an expanded variable
and now you don't need to link it to the Comms var
All in all read these
#HELP showdb
#HELP %expanddb
#HELP loopdb
also well your way is the long way to do it, that method works correctly for me.
Edit: fixed var refrence |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Sep 04, 2004 8:22 pm |
Quote: |
Inside of the #forall, the %db returns an empty string.
|
Works for me! I just copied your example and ran the alias, and got:
steel...200
wood...150
The problem must be something else. |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
|
|