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] Technique for Today vs. Yesterday. Data Stored in Rows

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Technique for Today vs. Yesterday. Data Stored in Rows
 Login/Join
 
Gold member
posted
Morning All,

We have a strange problem, we are looking at our inventory changes today vs. yesterday, we have a .fex that will get us the two dates to a hold file, then insert that in list as a where statement on our second query.

This limits our results from a few million record table, but the data is stored like this...


JOB DATE	WHSE	Item	NET QTY1
105361	10099990007	1012776	2354
105361	10099990009	1538937	2341
105362	10099990002	1005333	10
105362	10099990002	1274486	3




Hold file to get yesterday/today

  
TABLE FILE F568304
BY  HIGHEST 2 JOBDATE
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE SAVE AS 'HOLD1' FORMAT ALPHA
END


We want to subtract by the different dates in the rows, this example just gives us the two values for the two days (we tried a few things, but didn't get it to work):

  

TABLE FILE F568304
SUM
     NetChange
BY LOWEST  JOBDATE
WHERE ( Q2DXJ IN FILE HOLD1 );


Appreciate any help, once we have a working example we can do this anywhere Smiler

*Edits- Cleaned up the example.

Thank you,

JC

This message has been edited. Last edited by: <Kathryn Henning>,


WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Virtuoso
posted Hide Post
In such cases we use MATCH FILE on the results for today and those for yesterday.
MATCH
FILE F568304
SUM NetChange AS NetChangeToday
WHERE JOBDATE EQ &Today;
RUN
FILE F568304
SUM NetChange AS NetChangeYesterday
WHERE JOBDATE EQ &Yesterday;
AFTER MATCH HOLD OLD-OR-NEW
END

TABLE FILE HOLD
SUM Diff/D12.2 = NetChangeToday - NetChangeYesterday;
END


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
We would do a define or compute
/*
DEFINE FILE F568304
NETTODAY/D20.2=IF JOBDATE EQ &TODAY THEN Netchange ELSE 0;
NETYESTR/D20.2=IF JOBDATE EQ &YESTERDAY THEN Netchange ELSE 0;
END
TABLE FILE F568304
SUM NETTODAY NETYESTR
COMPUTE NETCHANGE/D20.2= NETYESTR - NETTODAY;

WHERE JOBDATE EQ &TODAY OR &YESTERDAY
END


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Gold member
posted Hide Post
If the 2 dates in HOLD1 changes everyday. How do I get them to &values.

Would I do a -READ? I've only used that in tables with 1 record, then used that one record as a where statement.

Appreciate the feedback!

JC


WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Guru
posted Hide Post
Try something like this
/*
-SET &BASEDATE = &YYMD ;
-SET &TODAY = DATECVT (&BASEDATE,'I8YYMD','YYMD');
-SET &YESTERDAY = DATEADD(&CURDATE, 'D', -1);


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Gold member
posted Hide Post
I've done something like that, but not like a century julian.

CYDDD (P7)

Would it be the same type of -set values?


WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Guru
posted Hide Post
As long as the dates you are comparing are in the same format, I don't see why not. Just try it and see what happens.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Gold member
posted Hide Post
How do I populate &CURDATE? It's prompting for it.


WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Guru
posted Hide Post
i miised a change. It should be &today.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Gold member
posted Hide Post
Code:

  
-SET &BASEDATE = &YYMD ;
-SET &TODAY = DATECVT (&BASEDATE,'I8YYMD','YYMD');
-SET &YESTERDAY = DATEADD(&TODAY, 'D', -1);

DEFINE FILE F568304
NETTODAY/D20.2=IF JOBDATEEQ &TODAY THEN NETCHANGE ELSE 0;
NETYESTR/D20.2=IF JOBDATEEQ &YESTERDAY THEN NETCHANGE ELSE 0;
END
TABLE FILE F568304
SUM NETTODAY NETYESTR
COMPUTE NETCHANGE/D20.2= NETYESTR - NETTODAY;
WHERE JOBDATEEQ &TODAY OR &YESTERDAY
END



FOCUSEXE:
  

 SET TRACEOFF = ALL
 SET TRACEON = STMTRACE//CLIENT
 SET TRACEON = STMTRACE/2/CLIENT
 SET TRACEUSER = ON
 SET XRETRIEVAL = OFF
 -SET &BASEDATE = 20130419 ;
 -SET &TODAY = DATECVT (20130419,'I8YYMD','YYMD');
 -SET &YESTERDAY = DATEADD(41017, 'D', -1);
 DEFINE FILE F568304
 NETTODAY/D20.2=IF JOBDATEEQ 41017 THEN NETCHANGE ELSE 0;
 NETYESTR/D20.2=IF JOBDATEEQ 41016 THEN NETCHANGE ELSE 0;
 END
 TABLE FILE F568304
 SUM NETTODAY NETYESTR
 COMPUTE NETCHANGE/D20.2= NETYESTR - NETTODAY;
 WHERE JOBDATEEQ 41017 OR 41016
 END



SQL:
  
 14.57.57 AE    SELECT
 14.57.57 AE    SUM((CASE (T1."NETCHANGE")  WHEN 41017 THEN T1."NETCHANGE" ELSE 0
 14.57.57 AE   END)),
 14.57.57 AE    SUM((CASE (T1."NETCHANGE")  WHEN 41016 THEN T1."NETCHANGE" ELSE 0
 14.57.57 AE   END))
 14.57.57 AE    FROM
 14.57.57 AE   HSIQDTA71/F568304 T1
 14.57.57 AE    WHERE
 14.57.57 AE   (T1."JOBDATE" IN(41017, 41016))
 14.57.57 AE    FOR FETCH ONLY;



Edits- Made field names more freindly.

This message has been edited. Last edited by: John C.,


WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Guru
posted Hide Post
John,

This works?


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Gold member
posted Hide Post
The date being sent in SQL doesn't match the CYDDD, so returns 0 records.


WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Gold member
posted Hide Post
Tried this:

Probably not the way to go.. but..

  
-SET &BASEDATE = JULDAT(&YYMD, 'I6') + 100000;
-SET &BASEDATEYES = JULDAT(&YYMD, 'I6') + 100000 - 1;
-TYPE &BASEDATE ... &BASEDATEYES
-EXIT



Run

  
 -SET &BASEDATE = JULDAT(20130419, 'I6') + 100000;
 -SET &BASEDATEYES = JULDAT(20130419, 'I6') + 100000 - 1;
 -TYPE 113109 ... 113108
 113109 ... 113108
 -EXIT




WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Gold member
posted Hide Post
quote:
-SET &BASEDATE = JULDAT(&YYMD, 'I6') + 100000;
-SET &BASEDATEYES = JULDAT(&YYMD, 'I6') + 100000 - 1;
-TYPE &BASEDATE ... &BASEDATEYES
-EXIT


Anyone know a good way to look at the weekend? If monday I need to go to friday's date.


WF 7703 Outputs all
Windows 7 32
DB2 CLI
 
Posts: 59 | Registered: August 09, 2012Report This Post
Guru
posted Hide Post
Do you mean Julian format? if you do, you can convert from Julian to Gregorian using a WebFOCUS Fucntion.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report 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] Technique for Today vs. Yesterday. Data Stored in Rows

Copyright © 1996-2020 Information Builders