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.
A bit of tinkering. I created 2 files in the spirit of what you posted. The T1 file has both dates. See if this answers your problem:
-* File Waz.fex
TABLE FILE GGSALES
SUM UNITS
BY PRODUCT
RANKED BY DATE
ON TABLE HOLD AS T2 FORMAT FOCUS INDEX DATE
END
DEFINE FILE T2
P1/I3 WITH PRODUCT=IF PRODUCT EQ LAST PRODUCT THEN LAST P1 ELSE 1 + RDUNIF('D5.4') * 24;
P2/I3 WITH PRODUCT=IF PRODUCT EQ LAST PRODUCT THEN LAST P2 ELSE 1 + RDUNIF('D5.4') * 24;
END
TABLE FILE T2
LIST DATE BY PRODUCT BY DATE NOPRINT
WHERE RANK EQ P1 OR RANK EQ P2
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS T1A
END
TABLE FILE T1A
SUM DATE AS DATE
BY PRODUCT
ACROSS LIST
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS T1 FORMAT FOCUS
END
-RUN
JOIN FILE T1 AT DATE1 TAG T1
TO MULTIPLE
FILE T2 AT DATE TAG T2 AS WAZ
WHERE T1.PRODUCT EQ T2.PRODUCT AND T1.DATE1 LE T2.DATE;
WHERE T1.PRODUCT EQ T2.PRODUCT AND T1.DATE2 GE T2.DATE;
END
TABLE FILE T1
PRINT T1.DATE1 T1.DATE2 T2.DATE T2.UNITS
BY T1.PRODUCT
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
I have working code that joins each table 1 record to all table 2 records, but the performance is abysmal.
How is your Focus file structured?
If there is a sizeable collection of dependent fields in the reference table (file 2), it's advisable to isolate them from the fields that are needed to establish a match (item identifier, effective date expiry date), by placing them in a segtype=U segment.
If you build the reference table on the fly, with a multi-verb request, each verb in the TABLE ... HOLD request will generate a separate segment in the Focus file, with segtype reflecting its additional keys relative to its immediate parent. Thus,
TABLE FILE data_source
SUM COMPUTE NADA/A1=; NOPRINT
BY item_id
SUM FST.expiry_date
BY item_id
BY effective_date
SUM other data fields
BY item_id
BY effective_date
ON TABLE HOLD FORMAT FOCUC INDEX item_id
END
will produce a three-segment Focus file, with segtype of S1, S1, and U (respectively). A condition-based join of file 1 to this structure will use the index on item_id to locate the appropriate instance of the top segment; and will sift through its chain of children in the level two segment until the instance covering the date is located; and will then pull the price info from the corresponding level-three segment instance.
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Why don't you extract all the key data for the join from table 1 where the records matc hthe date range, hild the file and then join to the Price table?
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
Better yet, put it into an RDBMS that understands ranged types, such as PostgreSQL!
The downside; if you don't already have the required adapter, that solution gets expensive...
P.S. I have no experience with the WebFOCUS PostgreSQL adapter and have no idea what quality the queries it sends to the DB are. Unfortunately we don't use PG @work here.
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 :