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 there any way to pass a parameter to a script of SQL passthru? I'm trying to cut to the chase on a code that will return values based on date that won't exaust time on the answer-set and recalc on the Report server. Basically I'd like to do this:
SQL SQLORA SELECT * FROM TABLEA WHERE TABLEA_DATE > &PARAM; TABLE FILE SQLOUT PRINT * ON TABLE HOLD AS MYHOLD END
With Dialog Manager, the variable value replaces the variable name before the line of code is processed. The only case this does not happen is when a variable contains another variable, you have to append .EVAL to the variable name - but that's another story.
Be aware that Date-Time columns in relational dbs are treated as alpha in SQL, you have to use quotes. Also, depending on the type of relational db, the date should probably use "-" as separator, e.g. '2006-11-27'.
As far as I know, this is the syntax to use:
SET SQLENGINE=SQLORA SQL SELECT * FROM TABLEA WHERE TABLEA_DATE > '&PARAM'; TABLE ON TABLE HOLD AS MYHOLD END
You may also need to provide the server name, if more than one WF data adapter is defined:
SQL SET SERVER server-name
This goes between the SQLENGINE command and the SELECT command.This message has been edited. Last edited by: Francis Mariani,
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
I've verified that that works, but will it detect the fact that there is a parameter if I put it the same way I had in my previous post? Like an amper-variable? Or would SQL not know what to do with it?
I keep trying it but for some reason my SQL results and my results from Developer are not the same. I'm trying to use the SQL function "to_date" so that the user can enter dates in the format 'MM/DD/YYYY' instead of 'YYYY/MM/DD'. Does this change anything on this end?This message has been edited. Last edited by: gregson06,
I am convinced that this is the issue, infact when I copy the script exactly between the sql tool and Developer I get totally different answers, as if FOCUS is looking for something else. Nothing seen differently with ECHO=ON, I'm not sure where else to look or how else to rephrase it.This message has been edited. Last edited by: gregson06,
I'll try using this format. I managed to get the dates to work using TABLE but not through the SQL Passthru. I'll keep the forum posted incase it's not.
Thanks again!This message has been edited. Last edited by: gregson06,
G : To add to FM's note, you should be able to use DM to set dates and use the variables in your SQL. But the important thing is to make sure that you are using the correct date formats.
At our site for instance, when we use SQL-passthru to DB2, we have use the CCYY-MM-DD format for DATE format fields. Whereas the same field would be used as just CCYYMMDD if I was coding the same WHERE in FOCUS code. Use (SET XRETRIEVAL=OFF) in combination with (-SET &ECHO=ALL; ) to see how the varaible is being plugged in the SQL code. This will check the SQL syntax and return you the code without actually executing it. -* SET XRETRIEVAL=OFF -SET &ECHO=ALL; -* -SET &TODY1=EDIT(&YYMD,'9999-99-99'); -* SQL DB2 SELECT FLD1 ,FLD2 FROM DBNME.TBL1 A WHERE PROCESS_DATE = '&TODY1.EVAL' ; TABLE ON TABLE HOLD AS HOLD000 END -RUN -*
Hope that helps. Sandeep M.
------------------------------------------------------------------------------------------------- Blue Cross & Blue Shield of MS WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !!
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006
I do this all the time. Assuming the date is valid and in mm/dd/yyyy format with the slashes, here's what we do:
-SET &MYDATE=EDIT(&PARAM,'99$99$9999'); SET SQLENGINE=SQLORA SQL SELECT * FROM TABLEA WHERE TABLEA_DATE > TO_DATE('&MYDATE','MMDDYYYY'); TABLE ON TABLE HOLD AS MYHOLD END
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006