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     WebFOCUS Version of Excel VLOOKUP?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
WebFOCUS Version of Excel VLOOKUP?
 Login/Join
 
Guru
posted
Hi all,

Is there a WebFOCUS equivalent to the MS Excel VLOOKUP function?

I have a table that contains values corresponding to an attrition curve. Based on a calculation in my main report I need to look up a value from the attrition table. I also need to be able to match the next lowest value if an exact match is not found.

For example, if my calulation result is 0.0075 I would return the value 0.59 from the table below.

0.0027 0.57
0.0041 0.58
0.0058 0.59
0.0080 0.60
0.0106 0.61
0.0138 0.62

Any suggestions on how to accomplish this?

Thanks,

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Expert
posted Hide Post
Dan,

There is a new function in 76x called DB_LOOKUP but it looks like it only does equality.

But, try looking up 'conditional join' in Advanced Search. This may be what you need:

quote:
Using conditional JOIN syntax, you can establish joins based on conditions other than equality between fields. In addition, the host and cross-referenced join fields do not have to contain matching formats, and the cross-referenced field does not have to be indexed.

The conditional join is supported for FOCUS and for VSAM, ADABAS, IMS, and all relational data sources. Because each data source differs in its ability to handle complex WHERE criteria, the optimization of the conditional JOIN syntax differs depending on the specific data sources involved in the join and the complexity of the WHERE criteria.

The standard ? JOIN command lists every join currently in effect, and indicates any that are based on WHERE criteria.


--------------------------------------------------------------------------------
Top of page
--------------------------------------------------------------------------------


Syntax: How to Create a Conditional JOIN
The syntax of the conditional (WHERE-based) JOIN command is

JOIN [LEFT_OUTER|INNER] FILE hostfile AT hfld1 [TAG tag1]
[WITH hfld2]
TO {UNIQUE|MULTIPLE}
FILE crfile AT crfld [TAG tag2] [AS joinname]
[WHERE expression1;
[WHERE expression2;
...]
END


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Guru
posted Hide Post
Thanks Ginny! I'll research your suggestions.


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Virtuoso
posted Hide Post
Dan

I have found this to work:
APP FI MASTER DISK LOOK.MAS
-RUN
-WRITE MASTER FILENAME=LOOK, SUFFIX=FOC
-WRITE MASTER SEGNAME=ONE, SEGTYPE=S1
-WRITE MASTER FIELDNAME=BLANK       ,ALIAS=    ,USAGE=A1   ,INDEX=I ,$
-WRITE MASTER SEGNAME=TWO, SEGTYPE=S1
-WRITE MASTER FIELDNAME=LU_FIELD    ,ALIAS=    ,USAGE=P6.4 ,$
-WRITE MASTER FIELDNAME=RT_FIELD    ,ALIAS=    ,USAGE=P4.2 ,$
CREATE FILE LOOK
MODIFY FILE LOOK
FREEFORM BLANK LU_FIELD RT_FIELD
DATA
' ',0.0027,0.57,$
' ',0.0041,0.58,$
' ',0.0058,0.59,$
' ',0.0080,0.60,$
' ',0.0106,0.61,$
' ',0.0138,0.62,$
END
-RUN

JOIN 
BLANK WITH SEATS IN CAR TO BLANK IN LOOK AS J1
END
DEFINE FILE CAR
BLANK/A1 WITH SEATS = ' ';
LU_HERE/P6.4  = SEATS/400;
END
TABLE FILE CAR
SUM 
MIN.LU_HERE MAX.LU_FIELD MAX.RT_FIELD
BY COUNTRY BY SEATS
WHERE (LU_FIELD LE LU_HERE) ;
END


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Neat solution Alan, just goes to show that breaking the problem down to it's basic state is often the best way.

In this one Dan required something less than or equal to his input. Enter stage left, a form of McGyver and voila! result!!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Guru
posted Hide Post
Thanks to all of you for your suggestions. I hate to admit it but I'm so new to WebFOCUS and programming in general that it will take me some time to get my head around these ideas. I see them as great learning opportunities!

In the interest of time, however, I just created a DEFINE field with a long IF THEN ELSE statement that looks like...

...
IF FIELDNAME GE -0.0138 AND FIELDNAME LT -0.0106 THEN 0.38 ELSE
IF FIELDNAME GE -0.0106 AND FIELDNAME LT -0.0080 THEN 0.39 ELSE
IF FIELDNAME GE -0.0080 AND FIELDNAME LT -0.0058 THEN 0.40 ELSE
IF FIELDNAME GE -0.0058 AND FIELDNAME LT -0.0041 THEN 0.41 ELSE
IF FIELDNAME GE -0.0041 AND FIELDNAME LT -0.0027 THEN 0.42 ELSE
IF FIELDNAME GE -0.0027 AND FIELDNAME LT -0.0017 THEN 0.43 ELSE
...


I know it's crude but it works for now. We'll see if it has any sort of performance impact when I apply it to the full data set.

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report 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     WebFOCUS Version of Excel VLOOKUP?

Copyright © 1996-2020 Information Builders