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.
Type of files, as Ginny suggests, will make a difference. Flat files have additional issues, keys on fields in RDBMS tables, etc.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
Also, DEFINE FILE STORE and TABLE FILE HOLD will never work.
And while I'm at it, here are some other restrictions from the manual that should be adhered to:
The maximum number of pairs that can be used to match records is 63.
If the lookup file is a fixed format sequential file, it must be sorted and retrieved in the same order as the source file. The sequential file's key field must be the first lookup field specified in the DB_LOOKUP request. If it is not, no records will match.
In addition, if a DB_LOOKUP request against a sequential file is issued in a DEFINE FILE command, you must clear the DEFINE FILE command at the end of the TABLE request that references it or the lookup file will remain open. It will not be reusable until closed and may cause problems when you exit WebFOCUS. Other types of lookup files can be reused without clearing the DEFINE. They will be cleared automatically when all DEFINE fields are cleared.
If the lookup field has the MISSING=ON attribute in its Master File and the DEFINE or COMPUTE command specifies MISSING ON, the missing value is returned when the lookup field is missing. Without MISSING ON in both places, the missing value is converted to a default value (blank for an alphanumeric field, zero for a numeric field).
Source records display on the report output even if they lack a matching record in the lookup file.
Only real fields in the lookup Master File are valid as lookup and return fields.
If there are multiple rows in the lookup table where the source field is equal to the lookup field, the first value of the return field is returned.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
Sorry for the insufficient information provided in my previous post.. Now I created below two tables by Excel & uploaded it.
Source table - Store Lookup table - Refer
In real life scenario , Source will be in the SAP & Lookup will be either in EXcel or DB2 , since we have no connectivity in the system, we are just doing a POC.
Table name :store { primary Key -Prodid }
Prodid Items value 1 Rice A 2 vanilla B 3 Bru C 4 Wheat A
Table name : Refer {Primary Key - F1 }
F1 F2
x A Y B Z C
I need to look up the fields - Value & F2 ; Returning field - F3
I NEED THE OUTPUT AS
PRODID ITEMS VALUE PLK 1 RICE A X 2 vanilla B Y 3 Bru C Z 4 Wheat A X
As suggested by Darin Lee, i removed the hold file .
and did the coding as below..
TABLE FILE REFer PRINT F2 BY F1 END DEFINE FILE STORE PLK/A50=DB_LOOKUP(Refer,VAL,F2,F1) END TABLE FILE STORE PRINT PLK VALUE ITEMS BY PRODID END
But I didn't get the output. Is ther any other way to get it??? Any suggestions??
Thanks DARIN LEE & GiNNYJAKES for ur suggestions for my previous post..
OS-Windows XP
WebFOCUS 7.6.4,7.6.9 OS: Windows XP HTML,EXCEL,PDF
Sorry for the confusion - what I was suggesting was that you can't do a DEFINE on STORE and TABLE on HOLD and get the desired results. Both the DEFINE and the TABLE must reference the same file.
As for the other way to get it, try the JOIN. There's not any difference in efficiency between what you're trying to do with the DB_LOOKUP function and using a JOIN and it appears that any requirements for sort order, etc. will be in effect for either one.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
Go back to your very first post. You posted that there is an error generated:
quote:
Data retrieval has been killed & job has been stopped
This means that the order of the data is unexpectedly incorrect, in other words, that the file you use to look the values up in is out of order compared to the host file. Your files are now stored in excel - which means that you use the odbc connector to retrieve the data - and that means that is basicly nothing more than a fixed file. Thus, the records in refer must be in the same order as in store. Which they are not, when looked at it from the value/f2 fields. The following will work with this environment (at least it does so in my system):
TABLE FILE STORE
PRINT PRODID ITEMS
BY VALUE
ON TABLE HOLD
END
DEFINE FILE HOLD
PLK/A50=DB_LOOKUP(Refer,VAL,F2,F1)
END
TABLE FILE HOLD
PRINT PLK VALUE ITEMS
BY PRODID
END
Hope this helps...
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
Thanks a lot for your suggestions.. I got the output . I did the coding as suggested by Gamp. Problem with lookup is resolved. Special thanks to GAMP..
WebFOCUS 7.6.4,7.6.9 OS: Windows XP HTML,EXCEL,PDF
If the lookup file is a fixed format sequential file, it must be sorted and retrieved in the same order as the source file. The sequential file's key field must be the first lookup field specified in the DB_LOOKUP request. If it is not, no records will match.
Way back in the beginning.....
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007