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     [SOLVED] Selecting between several joins

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Selecting between several joins
 Login/Join
 
Member
posted
Hi all.

I have a problem i am trying to solve in a good way. I am running WF 7.6. I have the following joins:

JOIN CLEAR *
JOIN DATEPRICEKEY4 IN GHS_WM_KEYED TAG A TO DATEPRICEKEY IN GHS_ADDITIONAL_PRICELIST_ALL TAG B AS J1;
JOIN DATEPRICEKEY2 IN GHS_WM_KEYED TAG A TO DATEPRICEKEY IN GHS_ADDITIONAL_PRICELIST_ALL TAG C AS J2;
JOIN DATEPRICEKEY3 IN GHS_WM_KEYED TAG A TO DATEPRICEKEY IN GHS_ADDITIONAL_PRICELIST_ALL TAG D AS J3;
JOIN DATEPRICEKEY1 IN GHS_WM_KEYED TAG A TO DATEPRICEKEY IN GHS_ADDITIONAL_PRICELIST_ALL TAG E AS J4;


I am here trying to put a price on some product. There are 4 ways this product can be priced, depending on the agreement with the customer; thus 4 keys. The E join is the default value to choose if the JOIN does not come up with any price. The problem in itself is solvable with the following code in my PRINT segment:

COMPUTE FREE/I4 = IF B.PRICEKEY NE '' THEN B.FREE ELSE
IF C.PRICEKEY NE '' THEN C.FREE ELSE
IF D.PRICEKEY NE '' THEN D.FREE ELSE
E.FREE;

Allthough it works, i don't file that this is good coding, nor a good approach to do this for each column in the table. I was wondering if anyone had any idea whether it was possible to solve this in a manner more like this:

-IF B.DATEPRICEKEY NE '' GOTO BJOIN;
-IF C.DATEPRICEKEY NE '' GOTO CJOIN;
-IF D.DATEPRICEKEY NE '' GOTO DJOIN;
-GOTO EJOIN

-BJOIN

B.FREE B.INT1 B.PRICE .....

-GOTO THE_END
-CJOIN

C.FREE C.INT1 C.PRICE ....
.
.
.


-THE_END
END

And so on. I have tried this, but it checks the first row and then uses this for the rest of the table. Is it anyway i can make a code like this that would work row by row?

Any ideas would be much appreciated.

Regards Jørgen

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.0
Windows, All Outputs
 
Posts: 4 | Location: Norge | Registered: February 04, 2014Report This Post
Virtuoso
posted Hide Post
quote:
COMPUTE FREE/I4 = IF B.PRICEKEY NE '' THEN B.FREE ELSE IF C.PRICEKEY NE '' THEN C.FREE ELSE IF D.PRICEKEY NE '' THEN D.FREE ELSE E.FREE;

That looks like the appropriate approach, given that the value to select from among B-E needs to be determined on a row-by-row basis.

One suggestion: DEFINE (rather than COMPUTE) may be more efficient, if the data source is a relational database provided WF will pass the calculation in the generated SQL.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Member
posted Hide Post
Thanks J, i was afraid that was the appropriate approach. Another approach could have been just picking out the appropriate key, write it down on a hold file and then make a new join with just that key. But that would require writing to disk which i believe in turn would take more time. In my opinion it is better to avoid writing to disk if possible.

I agree with on the compute/define thing. I will try to put it in the define.

Thanks!


WebFOCUS 8.0
Windows, All Outputs
 
Posts: 4 | Location: Norge | Registered: February 04, 2014Report 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     [SOLVED] Selecting between several joins

Copyright © 1996-2020 Information Builders