Focal Point
[CLOSED] Is there a way to execute SQL Server Table valued Functions from Webfocus?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3527012786

July 12, 2017, 05:39 AM
Yashwanth
[CLOSED] Is there a way to execute SQL Server Table valued Functions from Webfocus?
Hi All,

Is there a way to execute SQL Server Table valued Functions from Webfocus?
(Like we can execute the stored procedure)


Thanks,
Yeshwanth

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 7.7.3
Windows, All Outputs
July 12, 2017, 08:59 AM
BabakNYC
I believe there's a technique for this. Reporting from MSS Table-Valued Functions can be done via synonym for SQL string containing a SELECT * FROM with parameters list. Create synonym for External SQL Script and add Variable definition (VARIABLE NAME=&&VARNAME) to the synonym.

I found this workaround here: https://techsupport.informatio...ttrack/10853551.html


WebFOCUS 8206, Unix, Windows
July 13, 2017, 09:02 AM
Geoff Fish
dead link


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
July 13, 2017, 09:05 AM
BabakNYC
For example:

1.
 Assume there is a MS SQL Table-Valued Function defined as
 CREATE FUNCTION dbo.ufnGetContactInformation(@ContactID int)
 RETURNS @retContactInformation TABLE
 (
  -- Columns returned by the function
  ContactID int PRIMARY KEY NOT NULL,
  FirstName nvarchar(50) NULL,
  LastName nvarchar(50) NULL,
  JobTitle nvarchar(50) NULL,
  ContactType nvarchar(50) NULL
 );...RETURN;
 END;

2.
 The following SQL can be used to report from the function:
  SELECT
  ContactID, FirstName, LastName, JobTitle, ContactType
  FROM dbo.ufnGetContactInformation(5)
 It needs to be saved to .SQL file.
 Note:
 - no semicolon at the end;
 - parameter @ContactID INT is temporarily used with hard-coded
 value 5, which will be substituted with parameter in the next
 steps

3.
 Create synonym for External SQL Script above and add Variable
 definition (VARIABLE NAME=&&CONTACTID) to the synonym:
 FILENAME=UFNGETCINFO, SUFFIX=SQLMSS , $
 VARIABLE NAME=&&CONTACTID,DEFAULT=1,$
  SEGMENT=UFNGETCINFO, SEGTYPE=S0, $
  FIELDNAME=CONTACTID, ALIAS=ContactID, USAGE=I11, ACTUAL=I4, $
  FIELDNAME=FIRSTNAME, ALIAS=FirstName, USAGE=A50V, ACTUAL=A50V,
  MISSING=ON, $
  FIELDNAME=LASTNAME, ALIAS=LastName, USAGE=A50V, ACTUAL=A50V,
  MISSING=ON, $
  FIELDNAME=JOBTITLE, ALIAS=JobTitle, USAGE=A50V, ACTUAL=A50V,
  MISSING=ON, $
FIELDNAME=CONTACTTYPE, ALIAS=ContactType, USAGE=A50V,
 ACTUAL=A50V,
  MISSING=ON, $

4.
 Add Variable to SQL Script FROM-clause
 dbo.ufnGetContactInformation(&&CONTACTID) and use TABLE to
 produce a report:
 -* using non-default parameter value, e.g. 5:
 -SET &&CONTACTID = 5;
 TABLE FILE UFNGETCINFO
 PRINT *
 END



WebFOCUS 8206, Unix, Windows