Hi,
please handover the sql statement via predecessor xform atom (see documentation of SQL call atom).
In this predecessor atom, you can define variables or values with XSLT to be used for your sql statement.
Best regards
Bastian
P.S.: the global and local variables of B1i are either constants or they need to be defined at the beginning of your scenario flow (payload role S or T). You can't define them later in the flow, e.g. take any result from a sql call atom.