Apart from turning the list as into a string, which gbu solves nicely above, there is also be the problem of select beeing evaluated before the selection has been made unless the window is modal or the building of the select string is moved into the OK-button script.
Modal window example:
choice = {"rouge", "vert", "bleu", "jaune"};
recall_flag = 0;
NW = New Window( "Test",<<modal,
H List Box( Text Box( "choose colors" ), y = List Box( choice ) ),
V List Box(
Button Box( "OK",
choice = (y << getselected);
::recall_flag = 1;
)
)
);
choices = "'" || choice[1] || "'"; // First selected item
// Add more items if more than one
For( i = 2, i <= N Items( choice ), i++,
choices = choices || ", '" || choice[i] || "'"
);
select = "SELECT ...FROM ...WHERE Colors IN (" || choices || ")";
Non-modal example:
choice = {"rouge", "vert", "bleu", "jaune"};
recall_flag = 0;
NW = New Window( "Test", //<<modal,
H List Box( Text Box( "choose colors" ), y = List Box( choice ) ),
V List Box(
Button Box( "OK",
choice = (y << getselected);
::recall_flag = 1;
choices = "'" || choice[1] || "'";
For( i = 2, i <= N Items( choice ), i++,
choices = choices || ", '" || choice[i] || "'"
);
select = "SELECT ...FROM ...WHERE Colors IN (" || choices || ")";
NW << Close Window;
)
)
);