I'm not sure I understand exactly what you'd like to see but here's the JSL generated from a query like I showed above.
Notice the Where() portion. It's pure JSL. There are no variables that you could stick in your Custom SQL.
It looks like your choices for effort are:
- Writing the JSL to build the prompts and figuring out how to insert the responses into your SQL; or,
- Converting the query to Query Builder and letting it prompt for you.
I'm not sure which is more effort for you but converting to Query Builder seems more flexible and will give you more options in the long run.
New SQL Query(
Version( 130 ),
Connection(
connection_string
),
QueryName( "inventory" ),
Select(
Column( "warehouseid", "t1" ),
Column( "sku", "t1" ),
Column( "sku_description", "t1" ),
Column( "quantityonhand", "t1" ),
Column( "quantityonorder", "t1" )
),
From(
Table( "inventory", Schema( "Sporting Goods By Stan" ), Alias( "t1" ) ),
Table(
"warehouse",
Schema( "Sporting Goods By Stan" ),
Alias( "t9" ),
Join(
Type( Left Outer ),
EQ( Column( "warehouseid", "t9" ), Column( "warehouseid", "t1" ) )
)
),
Table(
"order_item",
Schema( "Sporting Goods By Stan" ),
Alias( "t6" ),
Join(
Type( Left Outer ),
EQ( Column( "sku", "t6" ), Column( "sku", "t1" ) )
)
),
Table(
"sku_data",
Schema( "Sporting Goods By Stan" ),
Alias( "t8" ),
Join(
Type( Left Outer ),
EQ( Column( "sku", "t8" ), Column( "sku", "t1" ) )
)
),
Table(
"retail_order",
Schema( "Sporting Goods By Stan" ),
Alias( "t7" ),
Join(
Type( Left Outer ),
EQ( Column( "ordernumber", "t7" ), Column( "ordernumber", "t6" ) )
)
)
),
Where(
In List(
Column( "department", "t8" ),
{"Water Sports"},
UI(
SelectListFilter(
ListBox,
Base(
"Categorical",
Prompt(
"Select a department:",
Character,
PromptName( "t8.department_1" ),
ValueSource(
Column(
"department",
Alias( "department" ),
Table(
"sku_data",
Schema( "Sporting Goods By Stan" )
)
)
)
)
)
)
)
)
)
) << Run;
-Jeff