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     How to use a DEFINED FUNCTION to lookup a value in another table

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to use a DEFINED FUNCTION to lookup a value in another table
 Login/Join
 
<leftcoastuser>
posted
I have a .foc data file with a record format that includes 4 fields with code numbers for which I need to lookup a value in a .foc code number table (the same table for all 4).

It has been suggested this might be done by defining a function to do the lookup, and then calling that function once for each code number field to get the corresponding value from the code number table.

Can anyone give me an example to get me started, or another suggestion?
 
Report This Post
Expert
posted Hide Post
Lefty,

Have you thought about using a join to achieve this (define based if necessary) or even DECODE.

If you're using MODIFY then LOOKUP is an alternative.
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
<leftcoastuser>
posted
Tony,

How would I use a join? I thought of that, I would have 4 joins, one for each code field to the code table, but couldn't figure out how to get a unique value returned for each of the codes.

Can I use a decode with a separate table? The code values have to live in a table because they are sourced/updated from another system. I can't hard code the values unfortunately.

Yes, I think a lookup is the way to go and that's what I'm having difficulty getting started with.
 
Report This Post
Virtuoso
posted Hide Post
Let's say the two files are alpha (with fields code1 through code4) and beta (with code and descr)

Issue the four joins with distinct TAG and AS names:
JOIN code1 IN alpha TO code IN beta TAG T1 AS J1
JOIN code2 IN alpha TO code IN beta TAG T2 AS J2
JOIN code3 IN alpha TO code IN beta TAG T3 AS J3
JOIN code4 IN alpha TO code IN beta TAG T4 AS J4

The values of "descr" corresponding to the four code fields in alpha can then be referenced as T1.descr, ..., T4.descr

(Issue "?FF alpha" to see for yourself.)
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
<leftcoastuser>
posted
Thank you Jack! That works perfectly, solves my problem very nicely :-)
 
Report 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     How to use a DEFINED FUNCTION to lookup a value in another table

Copyright © 1996-2020 Information Builders