I am looking for WEbfocus Equivalent for sql sample. Any help is appriciated
Regards SatiThis message has been edited. Last edited by: <Kathryn Henning>,
WEbfocus 7.7.02,HTML,PDF & Excel
August 19, 2015, 01:54 PM
RSquared
Sati, What are you trying to do?
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
August 19, 2015, 02:03 PM
Shru1
Hi,
I have to convert an existing report into Webfocus. The report criteria is a sample mix of random cities. I need to pull atleast one record for each cities but this should change everytime they run the report. In SQl there is a function called 'SAMPLE' which does this. I am looking for webfocus equivalent.
WEbfocus 7.7.02,HTML,PDF & Excel
August 19, 2015, 03:57 PM
prodrigu
Shru1,
Why dont you just use SQL Passthrough? That way you can keep your SQL Query.
While I haven't used it in a while there are several functions in WEbFOCUS to select Random values. Search the Focal Point using the word Random.
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
August 21, 2015, 12:32 PM
Shahram
Unfortunately there is no function similar to SAMPLE in WebFOCUS that I know, so we need to work around it.
This is the sample of SQL "SAMPLE" and it's output:
SELECT TOP 10 LastName FROM DimCustomer TABLESAMPLE(1 PERCENT)
First run Second Run Third Run
LastName LastName LastName Ortega Yang Romero Campbell Huang Bryant Hughes Torres Mehta Alvarez Zhu Malhotra Vazquez Johnson Diaz Chapman Ruiz Lu Anand Alvarez Raji Vazquez Mehta Moreno Martinez Verhoff Goel Chande Carlson Howard
------------------------------------------------------------------ This is one way to do in WebFOCUS:
TABLE FILE DIMCUSTOMER SUM COMPUTE random/D20.6 = RDNORM('D20.6'); NOPRINT BY TOTAL HIGHEST 10 random NOPRINT BY LASTNAME END
First run Second Run Third Run
LASTNAME LASTNAME LASTNAME Gonzalez Rizaldy Ramirez Ptaszynski Weadock Roessler Hee Anderson Jones Saraiva Weber Raman He Chander Kelly Gray Sanders Narayanan Palit Rodriguez Skjønaa Zheng Hill Thomas Ruggiero Madan Song Diaz Ferrier Jordan
All Releases All OS, All Outputs
August 21, 2015, 12:50 PM
Shru1
Hi All,
Thank you for all your suggestions!!! I really appreciate it. I will try them and post back
Thanks Sati
WEbfocus 7.7.02,HTML,PDF & Excel
August 23, 2015, 09:32 PM
StuBouyer
If Sharam's solution isn't giving you what you want then you can simply do a SQL pass thru to get your sample and then use WebFOCUS to format it
SQL SQLMSS PREPARE SQLOUT FOR
SELECT TOP 10 LastName FROM DimCustomer TABLESAMPLE(1 PERCENT)
END
TABLE FILE SQLOUT
PRINT LastName AS 'Last Name'
ON TABLE PCHOLD FORMAT HTML
END
You will need to change SQLMSS in the first line to match the data adapter you are using if it isn't SQL Server
Hope this helps
Stu
WebFOCUS 8.2.03 (8.2.06 in testing)
August 24, 2015, 07:26 AM
Danny-SRL
Shru, If you do not use SQL passthru, I suggest you use the RDUNIF function (which gives a uniform distribution) and not the RDNORM function (which gives a normal distribution meaning more numbers around the average).
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF