Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Is there a way in Webfocus/Infoassist to use CASE statements as sql does.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Is there a way in Webfocus/Infoassist to use CASE statements as sql does.
 Login/Join
 
Member
posted
Is there a way in Webfocus/Infoassist to use CASE statements as sql does.

Example:

case WHEN TIMESTAMPDIFF(SQL_TSI_DAY, CAST("LOB Dimension".LOB_RCVD_001 AS DATE),CAST (CURRENT_DATE AS DATE) ) BETWEEN 6 AND 10 then "Work Fact".Count else 0 end

Here When i Say LOB_RCVD_001 it is Application Received date.

Wanted to know how to have this Query set in Infoassist to get the results with the count for the days given above

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


WebFOCUS 8

Windows, Active Report
 
Posts: 1 | Registered: May 10, 2018Report This Post
Virtuoso
posted Hide Post
My SQL is rusty. Could you explain what you're trying to accomplish? From what I can tell, this is just an IF THEN ELSE in a DEFINE or a COMPUTE but maybe there's more to it than that.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
Use something such as (in a DEFINE or COMPUTE):

DateDiff /I3 = HDIFF(CURRENT_DATE, LOB_RCVD_001, 'day-of-year', 'I3');
TestDiff /I5 = IF DateDiff GE 6 and DateDiff LE 10 THEN Count ELSE 0;

Look into manual/help for how to use HDIFF and its component format/usage.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Expert
posted Hide Post
Yes!

A CASE command that is encountered in the sequential flow of a procedure is not executed.

You assign a unique name to each function using the CASE command.

Syntax: How to Use the CASE Command
The syntax for the CASE command is:

CASE functionname [TAKES p1/t1[,..., pn/tn]] [RETURNS result/t] [;]
[declarations]
commands
.
.
.
ENDCASE

Source: F1/Help from within App Studio.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
quote:
CASE functionname [TAKES p1/t1[,..., pn/tn]] [RETURNS result/t] [;]


I think you will find that CASE is in Maintain.

You should be able to issue ANSI SQL with a case command against any data source.

SQL
select country
case
when country = 'ENGLAND' then 'UK'
when country in ('W GERMANY','ITALY','FRANCE') then 'EUROPE'
else 'Other' END
from car
;
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
quote:
CASE is in Maintain

Really, Maintain Only??? OK, if so, I stand corrected.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
quote:
Really, Maintain Only??? OK, if so, I stand corrected.


Well, in relation to 8.1.04, haven't checked 8.2 documentation


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
"CASE Statements": Sounds like it should be a NFR...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Master
posted Hide Post
quote:
Originally posted by Doug:
"CASE Statements": Sounds like it should be a NFR...


How is CASE different than DECODE? I have numerous requests where I have a WHERE on a DECODE value in a DEFINE and when I look at the SQL generated, the DECODE is converted to a SQL CASE statement.


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, 2006Report This Post
Expert
posted Hide Post
quote:
How is CASE different than DECODE?


SQL CASE supports returning the results of a formula.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
As mentioned by someone before, I think with IF THEN ELSE IF THEN ELSE IF .... you can do what CASE does in SQL. Actually if you look at the generated SQL you will find that IF THEN ELSE in a DEFINE or COMPUTE will be translated into a CASE statement.


WebFocus 8206M, iWay DataMigrator, Windows, DB2 Windows V10.5, MS SQL Server, Azure SQL, Hyperstage, ReportCaster
 
Posts: 168 | Registered: March 29, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Is there a way in Webfocus/Infoassist to use CASE statements as sql does.

Copyright © 1996-2020 Information Builders