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.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
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:
Thanks Jack...I'll give that a try. Until your response, I was trying to do something like this. This is just a test query but it works...
-SET &SQLTEST = IF &DATETYPE EQ 'Bar Date' THEN ',a.assignment_id FROM PAL.SD sd, PAL.SD_ASSIGNMENT a WHERE a.sd_number = sd.sd_number;'<br />-ELSE 'FROM PAL.SD sd;';<br /><br /><br />SET SQLENGINE=SQLORA<br />SQL SET SERVER &MYSERV<br />SQL SELECT sd.sd_number,<br /> sd.doe_s_number<br /> &SQLTEST<br />END
However, it breaks if I try to pass an amper variable in the where string. It gives me an error about mssing quotes. Any ideas how I can get this to work?
-SET &SQLTEST = IF &DATETYPE EQ 'Bar Date' THEN ',a.assignment_id FROM PAL.SD sd, PAL.SD_ASSIGNMENT a WHERE a.sd_number = s.sd_number and a.begin_date >= &date1;'<br />-ELSE 'FROM PAL.SD sd;';<br /><br />SET SQLENGINE=SQLORA<br />SQL SET SERVER &MYSERV<br />SQL SELECT sd.sd_number,<br /> sd.doe_s_number<br /> &SQLTEST<br />END
Because you're embedding a DM variable inside another, you should use .EVAL. You may also require quotes around the date value:
-SET &SQLTEST = IF &DATETYPE EQ 'BAR DATE' - THEN ',A.ASSIGNMENT_ID FROM PAL.SD SD, PAL.SD_ASSIGNMENT A WHERE A.SD_NUMBER = S.SD_NUMBER AND A.BEGIN_DATE >= ''&DATE1.EVAL;''' - ELSE 'FROM PAL.SD SD;';