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     DEFINE-based JOIN problem

Read-Only Read-Only Topic
Go
Search
Notify
Tools
DEFINE-based JOIN problem
 Login/Join
 
<Pietro De Santis>
posted
According to the manual, the syntax for a normal JOIN is:

JOIN field1 [AND field1a...] IN host [TAG tag1]
TO [ALL] field2 [AND field2a...] IN crfile [TAG tag2] [AS joinname]
END

The syntax for a DEFINE-based JOIN is:

JOIN deffld WITH host_field IN hostfile [TAG tag1]
TO [ALL] cr_field IN crfile [TAG tag2] [AS joinname]
END

I would like to JOIN one DEFINEd field and one regular field from one Oracle table to two regular fields in another Oracle table.

The syntax I am using:

JOIN DEFFIELD1 WITH FIELD1 AND FIELD2 IN TABLE1
TO FIELD1 AND FIELD2 IN TABLE2 AS J1
END

I get the following error:

(FOC376) SYNTAX ERROR OR MISSING ELEMENT IN THE JOIN COMMAND

It appears I cannot JOIN a "virtual" field and a "real" field in one table to a "real" field and a "real" field in another table.

I need to join a P5 field and a A25 field to a A10 field and a A25 field in two Oracle tables.

Any ideas?

Thanks,

Pietro.
 
Report This Post
Virtuoso
posted Hide Post
I wonder if it isn't the FIELD1 AND FIELD2 that is giving you the error.

JOIN DEFFIELD1 WITH FIELD1 AND FIELD2 IN TABLE1
TO FIELD1 AND FIELD2 IN TABLE2 AS J1
END

I get the following error:

(FOC376) SYNTAX ERROR OR MISSING ELEMENT IN THE JOIN COMMAND

I don't know as I ever got two fields to join in a defined based join. I know we even had issues getting it to work in Web 4.3.6
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Master
posted Hide Post
Trick IT:

You can do this. Lets trick it. You can join on the 2 real fields and create your define field then add your own where statement for the other join. You can turn on SQL tracing and turn off retrieval execution to see the SQL by adding the below 3 line to the top of your focexec. NOTE: this trick only works for a SQL RDBMS and may not work for cross database joins.

SET TRACEON=STMTRACE//CLIENT
SET TRACEUSER=ON
SET XRETRIEVAL=OFF
 
Posts: 865 | Registered: May 24, 2004Report This Post
<Pietro De Santis>
posted
"You can join on the 2 real fields and create your define field then add your own where statement for the other join."

That sounds interesting - I may give it a try. Thanks.
 
Report This Post
Virtuoso
posted Hide Post
I assume use of WITH with a compound key is supported.

The WITH phrase doesn't really modify a particular key element -- it modifies the JOIN as a whole. "WITH wfld" specifies that the overall key for the join changes whenever a new instance of the segment containing wfld is read.

Thus the WITH phrase belongs after the list of key fields, and the WITH fieldname should be a field in the lowest segment that contributes to the overall key.

For example, if the first element of a two-piece key is a defined field based entirely on the root segment, but the second element of the compound key is in a lower segment,
JOIN fld1 AND fld2 WITH fld2
would be correct; WITH <some-field-in-the-root-segment> would yield incorrect results.

In your case, use:
JOIN DEFFIELD1 AND FIELD2
WITH FIELD1
IN TABLE1
TO FIELD1 AND FIELD2
IN TABLE2
AS J1
END
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Pietro De Santis:
[qb] . . .
I need to join a P5 field and a A25 field to a A10 field and a A25 field in two Oracle tables.
[/qb]
I assume the P5 is USAGE= P10, ACTUAL=P5.

Let's decompose the problem. There is a series of three challanges here:

1. For just the P5 to A10 equality test, can you express a single-key join as a SQL SELECT. It will depend on the functions supported by your RDBS for WHERE equality conditions (and on whether negative values can occur and how they are represented in the A10.)

2. Having composed a SELECT that satisfies (1), can the Focus interface to your RDBS be induced to generate such a SELECT to accomplish the single-key join? (If not, you're going to have to resort to SQL passthru.)

3. How to extend that to a two-key join: What's the Focus syntax for a define-based compound-key join?

Do you have you a solution in hand for #1?
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
When all else fails, I create hold files and concatenate my two fields into one for each file, then do the join on the concatenated fields.
Works like a charm!
 
Posts: 428 | Location: Springfield, MA | Registered: May 07, 2003Report 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     DEFINE-based JOIN problem

Copyright © 1996-2020 Information Builders