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.
After searching and reading many posts with no clear answer, I write to the pros in this forum:
Can I pass parameters to an MS SQL stored procedure when using a synonym to read the data or do I have to use SQL Pass-thru?
If I can, how is it done. I've tried using a WHERE and IF clause on my TABLE FILE along with setting defaults in the master and in my procedure and changing the spelling of the parameters and variables many different ways but with no success.
Any help is greatly appreciated.
As always, tia.This message has been edited. Last edited by: gregv,
Greg
current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11
According to the doc:
TABLE FILE synonym
PRINT [parameter [parameter] ... | *]
[IF in-parameter EQ value]
.
.
.
END
where:
synonym
Is the synonym of the stored procedure you want to execute.
parameter
Is the name of a parameter whose values you want to display in the report. You can specify input parameters, output parameters, or input and output parameters.
If the stored procedure does not require parameters, specify an asterisk (*). This displays a dummy segment, created when the synonym is generated, to satisfy the structure of the SELECT statement.
*
Indicates that you want to display all indicated parameters, or that there are no required parameters.
IF
Is an IF or WHERE keyword. Use this to pass a value to an IN parameter or an INOUT parameter in IN mode.
in-parameter
Is the name of an IN parameter, or INOUT parameter in IN mode, to which you want to pass a value.
Note: The length of in-parameters cannot exceed 1000 characters if the adapter is configured for Unicode support.
value
Is the value you are passing to a parameter.
WebFOCUS 8206, Unix, Windows
Posts: 1853 | Location: New York City | Registered: December 30, 2015
Here's a synonym I created for an sp in Adventurworks.
FILENAME=USPGETMANAGEREMPLOYEES, SUFFIX=SQLMSS , $
SEGMENT=INPUT, SEGTYPE=S0, $
FIELDNAME=@BUSINESSENTITYID, ALIAS=P0001, USAGE=I11, ACTUAL=I4,
MISSING=ON, ACCESS_PROPERTY=(NEED_VALUE), $
SEGMENT=OUTPUT, SEGTYPE=S0, PARENT=INPUT, $
FIELDNAME=@RETURN_VALUE, ALIAS=P0000, USAGE=I11, ACTUAL=I4, $
SEGMENT=ANSWERSET1, SEGTYPE=S0, PARENT=INPUT, $
FIELDNAME=RECURSIONLEVEL, ALIAS=RecursionLevel, USAGE=I11, ACTUAL=I4,
MISSING=ON, $
FIELDNAME=ORGANIZATIONNODE, ALIAS=OrganizationNode, USAGE=A4000, ACTUAL=A4000,
MISSING=ON, $
FIELDNAME=MANAGERFIRSTNAME, ALIAS=ManagerFirstName, USAGE=A50, ACTUAL=A50, $
FIELDNAME=MANAGERLASTNAME, ALIAS=ManagerLastName, USAGE=A50, ACTUAL=A50, $
FIELDNAME=BUSINESSENTITYID, ALIAS=BusinessEntityID, USAGE=I11, ACTUAL=I4,
MISSING=ON, $
FIELDNAME=FIRSTNAME, ALIAS=FirstName, USAGE=A50, ACTUAL=A50,
MISSING=ON, $
FIELDNAME=LASTNAME, ALIAS=LastName, USAGE=A50, ACTUAL=A50,
MISSING=ON, $
Here's a report you can run against it:
ENGINE INT CACHE SET ON
-DEFAULTH &WF_SUMMARY='Summary';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
TABLE FILE ibisamp/uspgetmanageremployees
SUM USPGETMANAGEREMPLOYEES.ANSWERSET1.RECURSIONLEVEL
USPGETMANAGEREMPLOYEES.ANSWERSET1.BUSINESSENTITYID
BY USPGETMANAGEREMPLOYEES.ANSWERSET1.MANAGERFIRSTNAME
BY USPGETMANAGEREMPLOYEES.ANSWERSET1.MANAGERLASTNAME
BY USPGETMANAGEREMPLOYEES.ANSWERSET1.FIRSTNAME
WHERE USPGETMANAGEREMPLOYEES.INPUT.@BUSINESSENTITYID EQ &BUSINESSENTITYID.(<1,1>, <2,2>, <3,3> |FORMAT=I11).@BUSINESSENTITYID:.;
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET CACHELINES 100
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET SQUEEZE ON
ON TABLE SET HTMLCSS ON
ON TABLE SET HTMLENCODE ON
ON TABLE SET EMPTYREPORT ON
ON TABLE SET GRWIDTH 1
ON TABLE SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, ORIENTATION=LANDSCAPE, HFREEZE=OFF, $
ENDSTYLE
END
-RUN
WebFOCUS 8206, Unix, Windows
Posts: 1853 | Location: New York City | Registered: December 30, 2015
You don't have a value for @EndDate. All input parameters need to have a value.
If you open the master file on the reporting server console, click Sample Data, you'll probably get prompted for both @StartDate and @EndDate. Unless you put a value into both parameters, you'll get the same error.This message has been edited. Last edited by: BabakNYC,
WebFOCUS 8206, Unix, Windows
Posts: 1853 | Location: New York City | Registered: December 30, 2015
TABLE FILE FLASHRPTAPPOINTMENTS
SUM
CNT.FLASHRPTAPPOINTMENTS.ANSWERSET1.APPOINTMENT_ID
BY FLASHRPTAPPOINTMENTS.ANSWERSET1.GENDER_NM
WHERE FLASHRPTAPPOINTMENTS.INPUT.@StartDate GE 20170301;
WHERE FLASHRPTAPPOINTMENTS.INPUT.@EndDate LE 20170331;
WHERE READLIMIT IS 10
END
(FOC1400) SQLCODE IS 201 (HEX: 000000C9) XOPEN: 42000
(FOC1500) : Microsoft OLE DB Provider for SQL Server: [42000] Procedure or function
(FOC1500) : 'FlashRptAppointments' expects parameter '@StartDate', which was not
(FOC1500) : supplied.
L (FOC1406) SQL OPEN CURSOR ERROR.
Greg
current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11
Could you try this code?
TABLE FILE FLASHRPTAPPOINTMENTS
SUM
CNT.FLASHRPTAPPOINTMENTS.ANSWERSET1.APPOINTMENT_ID
BY FLASHRPTAPPOINTMENTS.ANSWERSET1.GENDER_NM
WHERE P0001 GE 20170301;
WHERE P0002 LE 20170331;
WHERE READLIMIT IS 10
END
WebFOCUS 8206, Unix, Windows
Posts: 1853 | Location: New York City | Registered: December 30, 2015
TABLE FILE FLASHRPTAPPOINTMENTS SUM CNT.FLASHRPTAPPOINTMENTS.ANSWERSET1.APPOINTMENT_ID BY FLASHRPTAPPOINTMENTS.ANSWERSET1.GENDER_NM WHERE P0001 GE 20170301; WHERE P0002 LE 20170331; WHERE READLIMIT IS 10 END
Same outcome.
Greg
current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11
Update: If I run the 'Sample Data', for this same master, from App Studio I get the same error BUT if I run it from the Reporting Server Console I get records while passing @StartDate and @EndDate!
Any ideas why the difference?
Thanks.
Greg
current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11
Could it be as simple as needing quotes around the date? I have a similar master made from a stored procedure and use a very similar WHERE statement to yours.
-DEFAULTH &RunID = '{0CCBB6C0-DCC0-4A26-AB7F-1C39241E7E3E}';
TABLE FILE CCSGDETAIL2AE_WF
BY @RUNID
BY FY
BY RUN_PARM
BY HIGH_GROUP_PARM
BY GROUP_PARM
BY GROUP_ORDER
WHERE @RUNID EQ '&RunID';
END
WebFOCUS 8.2.03 - Production WebFOCUS 8.2.04 - Sand Box Windows 2012 R2 Server HTML, PDF, Excel In FOCUS since 1980
Posts: 115 | Location: Seattle, WA | Registered: April 07, 2015
Greg: Not that it should matter, but why are @StartDate and @EndDate Integers? I just created a master for SalesbyYear in Adventureworks and the parms have a format of HYYMDs. I'm wondering if that has something to do with it.
WebFOCUS 8206, Unix, Windows
Posts: 1853 | Location: New York City | Registered: December 30, 2015
Update: If I run the 'Sample Data', for this same master, from App Studio I get the same error BUT if I run it from the Reporting Server Console I get records while passing @StartDate and @EndDate!Any ideas why the difference?
Does the client have the same access rights as the reporting server?
WebFOCUS 8.2.03 - Production WebFOCUS 8.2.04 - Sand Box Windows 2012 R2 Server HTML, PDF, Excel In FOCUS since 1980
Posts: 115 | Location: Seattle, WA | Registered: April 07, 2015
TABLE FILE FLASHRPTAPPOINTMENTS
SUM
CNT.FLASHRPTAPPOINTMENTS.ANSWERSET1.APPOINTMENT_ID
BY FLASHRPTAPPOINTMENTS.ANSWERSET1.GENDER_NM
WHERE FLASHRPTAPPOINTMENTS.INPUT.@StartDate GE 20170301;
WHERE FLASHRPTAPPOINTMENTS.INPUT.@EndDate LE 20170331;
WHERE READLIMIT IS 10
END
(FOC1400) SQLCODE IS 201 (HEX: 000000C9) XOPEN: 42000
(FOC1500) : Microsoft OLE DB Provider for SQL Server: [42000] Procedure or function
(FOC1500) : 'FlashRptAppointments' expects parameter '@StartDate', which was not
(FOC1500) : supplied.
L (FOC1406) SQL OPEN CURSOR ERROR.
Does it work with EQ instead of GE/LE? I imagine it might be a bit difficult to translate those statements to function parameters... Actually, I'm pretty sure that's your problem.
If that's not it, I'm a bit suspicious about that INPUT segment in your condition. Have you tried with just:
WHERE @StartDate GE 20170301;
WHERE @EndDate LE 20170331;
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
It doesn't make sense to use GE/LE with a stored procedure. The Where statements are just passing parameters. The command for the stored procedure will not pass the operator. If you need the Dates to work as a between, that has to be within the stored procedure. You can't control that at the where statement.
Eric Woerle 8.1.05M Gen 913- Reporting Server Unix 8.1.05 Client Unix Oracle 11.2.0.2
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013
Wep522: Surprise to me, it works with EQ but not GE or LE! When I compare the record count for these 2 scenarios they don't match, meaning I have to figure out another way to do a range of start_date and end_date.
Thanks all for your time and suggestions!
Greg
current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11
Got it: No need to rewrite the fex since the GE and LE are built into the stored Procedure! I just need to pass the values for start_date and end_date!
Greg
current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11