How to achieve Pagination for Web Services in TIBCO Data Virtualization?

How to achieve Pagination for Web Services in TIBCO Data Virtualization?

book

Article ID: KB0076654

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization All supported versions

Description

This KB article explains the method of using Pagination for the TDV published Web Services.

Issue/Introduction

How to achieve Pagination for Web Services in TIBCO Data Virtualization?

Resolution

To achieve Pagination, use the following example SQL within a procedure and then publish it as a Web Service.

Here is a demo procedure which needs to be published as a Web Service.
PROCEDURE PaginationSample(IN pageNumber INTEGER, IN pageSize INTEGER, OUT result CURSOR (
ProductName VARCHAR(50),
ProductID INTEGER,
ProductDescription VARCHAR(255)
))
BEGIN
DECLARE pageNumber2 INTEGER;
DECLARE sqlText LONGVARCHAR;
SET pageNumber2 = pageNumber - 1 ;
SET sqlText=' SELECT
products.ProductName,
products.ProductID,
products.ProductDescription
FROM 
/shared/examples/ds_inventory/tutorial/products products ORDER BY ProductID OFFSET ' 
|| pageNumber2*pageSize || ' ROWS FETCH FIRST ' || pageSize ||' ROWS ONLY';

OPEN result FOR sqlText ;
END


Once this Web Service is published, use the http://localhost:9400/json/paginationws/PaginationSample?pageNumber=1&pageSize=15  url to access the Web Service.

Note: Replace the host , port and published Web Service name as applicable

Additional Information

Note: Use the attached CAR file for reference

Attachments

How to achieve Pagination for Web Services in TIBCO Data Virtualization? get_app