As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at firstname.lastname@example.org and provide your corporate email address, company, and name.
Is it possible to use dialog manager in a sql passthru to build a dynamic select statement without breaking the sql. I need to test the value of an amper variable and modify the select statement based on its value. If so, does anyone have an example?
Bear in mind that the fex is executed in two stages: In stage 1, Dialog Manager (which does not understand Focus syntax) performs all the DM directives (-if, -set, -repeat etc.); and performs substitution of DM &vars imbedded in the Focus lines, and stacks them for execution in stage 2. Stage 1 ends at end of the fex, or when -RUN, or -EXIT is encountered. In stage 2, Focus executes the stacked lines.
So you can insert DM statements between and around your lines of SQL and TABLE code, and perhaps imbed DM variables (amper vars) in the SQL code itself.
Add -RUN after the END statement if you want to resume DM processing after the data retrieval is complete, e.g., to test &LINES), and there you are.
Just make sure that the SQL (and TABLE) code generated will be valid, for all possible combinations of conditions (amper parameters).
For example, to screen on one or more columns, depending on input parameters, I have used code like this: