Try something like this. Note the use of evalinsert, panelbox, hlistbox, etc. Look them up in the scripting index for more information.
importDataPress = Function( {parameter_value},
sql_statement = evalinsert(
"SELECT * FROM DATABASE WHERE parameter = '^parameter_value^'");
show(sql_statement);
// This function is called when the button is pressed
name = New SQL Query(
Connection( "ODBC:DSN=DATABASE;PWD=XXX;" ),
QueryName( "my_table" ),
CustomSQL( sql_statement )
) << Run;
);
nw = new window("Example Input for SQL",
panelbox("Parameter Specification",
hlistbox(
text box("Enter value for parameter: "),
teb = text edit box("", << set width(200)),
),
),
panelbox("Actions",
hlistbox(
button box("Cancel", nw << close window),
button box("OK",
pvalue = teb << get text;
if (pvalue == "",
ew = new window("Error", << modal,
text box("Nothing specified")
);
,
// else import the data
importdatapress(pvalue);
nw << close window;
);
),
),
),
);