Defining Action_Tile for a Dynamic DCL in a loop

Defining Action_Tile for a Dynamic DCL in a loop

spencer.robertsU8DLN
Enthusiast Enthusiast
481 Views
1 Reply
Message 1 of 2

Defining Action_Tile for a Dynamic DCL in a loop

spencer.robertsU8DLN
Enthusiast
Enthusiast

I'm trying to create a dynamic sub-dialog, where depending on selections in the first, different options are shown. 

Given that this sub-dialog would need to work with roughly 15 different use cases, I tried to create one that would self define based on a list of Strings corresponding to the tiles. Everything seems to work, except for the action_tile line. It keeps getting tripped up on the very first (read x) according to the debugger.  As is, it crashes any time a selection is made in a popup_list.

 

(setq tiles (list "A" "B" "C" "D" "E" "F" )))
(setq s (open "C:\\TEMP\\jtest2.dcl" "w"))
(write-line "Test : dialog{ label = \"Test\"\;" s)
(foreach x tiles
(write-line (strcat ": popup_list  {edit_width = 15\; key = " x "\; label = " x "\; }") s)
)
(write-line "ok_cancel\;}" s)
(close s)

.....

(foreach x tiles
(or (eval (read (strcat "*" x "*"))) (set (read (strcat "*" x "*")) "0"))
(setq sqlString  (strcat "SELECT DISTINCT " x " FROM " table ";"))
(UpdateList x (set (read (strcat "" x "list")) (cons "" (cdr (mapcar 'car (dsql_query mydb sqlString))))))
(action_tile x (strcat "(set (read x) (nth (atoi (set (read (strcat \"*\" x \"*\")) $value)) (read (strcat x \"list\"))))")) 
);foreach

 

 Any advice or a different way to approach this? I would like to avoid needing to preset 15 different dialog boxes.

 

Thanks

0 Likes
Accepted solutions (1)
482 Views
1 Reply
Reply (1)
Message 2 of 2

spencer.robertsU8DLN
Enthusiast
Enthusiast
Accepted solution

Figured it out, needed to evaluate the 'x' as part of the strcat stage

 

Final String:

(action_tile x (strcat "(setq " x " (nth (atoi (set (read (strcat \"*\" \"" x "\" \"*\")) $value)) (eval (read (strcat \"\" \"" x "\" \"list\")))))"))
0 Likes