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.
I am working on a report and I am stuck at a point after completing the whole thing. I am sure someone would help me on this. Consider this is the table structure
ID Level Pre-level ID1 1 2 3 1 4 2 5
In this sample, for an ID named "ID1" there are 5 records as shown. But I need to show only 3 records named Level 3,4 and 5 because 3 replaced 1 (as shown in pre-level) and 4 replaced 2. So its like records with level 3,4 and 5 are only active. I need to eliminate level 1 and 2. There could be any number of levels.Please guide how to achieve this.
Thanks a lot..!!This message has been edited. Last edited by: Kerry,
MATCH FILE YOURFILE
PRINT ID LEVEL PRELEVEL
BY LEVEL
RUN
FILE YOURFILE
PRINT ID LEVEL PRELEVEL
BY PRELEVEL
AFTER MATCH HOLD OLD-NOT-NEW
END
By matching the file to itself. The 'old' has BY LEVEL and the 'new' has BY PRELEVEL. After match being 'old-not-new'. Should do the trick... I think...
might need some tweaking...
Greets,Dave
_____________________ WF: 8.0.0.9 > going 8.2.0.5
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010
Try doing a define DEFINE YOURFILE PRINT_LEVEL/A1=IF PRELEVEL GT 0 THEN PRELEVEL ELSE LEVEL; END TABLE YOURFILE PRINT ID LEVEL PRELEVEL BY PRINT_LEVEL END
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
Its alpha numeric field. I did try it. I think there should be a WHERE condition too. I dont see use of just creating PRINT_LEVEL and sorting by it..?! How will this eliminate records?
DEFINE YOURFILE
PRINT_LEVEL/A1=IF PRELEVEL GT 0 THEN PRELEVEL
ELSE LEVEL;
END
This will give you the following
ID Level Pre-level Print_Level
ID1 1 1
2 2
3 1 1
4 2 2
5 5
TABLE YOURFILE
PRINT
ID PRELEVEL
BY PRINT_LEVEL
BY HIGHEST LEVL
ON TABLE HOLD AS HOLDIT
END
This will give you the following
ID Level Pre-level Print_Level
ID1 3 1 1
1 1
4 2 2
2 2
5 5
DEFINE FILE HOLDIT
BYPASS_SW/A=IF Print_Level EQ LAST Print_Level
THEN 'Y' ELSE 'N';
END
TABLE FILE HOLDIT
PRINT *
WHERE BYPASS_SW EQ 'N';
END
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
That code would work *only* if you're always dealing with a single ID and if you never have a case of recursive level overriding. See for example this set of data (borrowed from GamP's example):
I would expect the following LEVELS to be displayed as a result:
4
6
7
8
9
Both Francis and GamP's techniques handle those cases accurately and do so even when multiple ID's exist so, unless your data contains always 1 single ID and no multiple/recursive overriding ever exists, you should attempt to implement either of those 2 techniques. RSquared's sample is a fine attempt but would not be sufficient for more complex cases.
By the way, thank you Francis for going through the trouble of working out the master file definition that allowed to have a "runnable" sample code
- Neftali.This message has been edited. Last edited by: njsden,
Wow, there's always something new under the sky (to me at least).
When Enigma006 posted his original question the lazy guy within me was just hoping that there would be a sort of "LAST on steroids" keyword that would allow me to inspect not only the previously retrieved record but all of them at once. I guess DB_LOOKUP does precisely that!
This DB_LOOKUP thing apparently works fine for you guys, but my server (769) does not like it - it crashes. So I'll just stick with the two-step approach. The 'F' in RTFM could also mean something quite different ...
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
I am not fully understand this DB_LOOKUP, it seems to me that any subsequent lookup is starting from the position of the previous sucessful DB_LOOKUP, not the entire file. You might have a missing returned even though the search value does exist in the file. Is this the case?
Hua
Developer Studio 7.6.11 AS400 - V5R4 HTML,PDF,XLS
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008
Is it about RTFM? believe or not, I have read this particular section in the documentation, my brain does not want to register them most of the time...
quote:
There are no restrictions on the source file. The lookup file can be any non-FOCUS data source that is supported as the cross referenced file in a cluster join. The lookup fields used to find the matching record are subject to the rules regarding cross-referenced join fields for the lookup data source. A fixed format sequential file can be the lookup file if it is sorted in the same order as the source file.
I thought DB_LOOKUP is a function, that every request with specific search values is a separate & unique request. If it works like join, I would prefer to join them, because I can access all the fields in xreference file.
Hua
Developer Studio 7.6.11 AS400 - V5R4 HTML,PDF,XLS
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008