Focal Point
[SOLVED] Where not recognised in JOIN command

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5987082516

January 10, 2012, 06:00 PM
bohorkez
[SOLVED] Where not recognised in JOIN command
Hi guys, I'm making a conditional join

  
JOIN PRO_COD         IN   PROMOTION TO
     PDI_PRO         IN   PDISCONT AS J4
     WHERE (PDI_IPC  EQ 'L')
     WHERE (PRO_FFV  EQ PDI_FFV)
     WHERE (PRO_DATE EQ &WK_DATE);
END


My program executes normally but in that block of code, it's shown:
UNKNOWN FOCUS COMMAND  WHERE
 BYPASSING TO END OF COMMAND


The three first letter of the fields indicates the table they belong (PRO_COD belongs to PROMOTION - PDI_IPC belongs to PDISCONT)
I'm not getting an error, but I think that my join is not being executed the right way.

Do you know how I could resolve that?

Thank you so much.

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.1.4
Windows, All Outputs
January 10, 2012, 06:13 PM
Francis Mariani
Try a semicolon after each WHERE statement...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 10, 2012, 06:17 PM
bohorkez
quote:
Originally posted by Francis Mariani:
Try a semicolon after each WHERE statement...


I tried that but the result is the same...


WebFOCUS 7.1.4
Windows, All Outputs
January 10, 2012, 08:53 PM
Francis Mariani
Try one WHERE at a time to determine which one might be the culprit.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 11, 2012, 02:47 AM
GamP
Try reading up on the documentation concerning conditional joins. The example in the doc is:
JOIN FILE VIDEOTRK AT MOVIECODE TAG V1 TO ALL 
     FILE MOVIES   AT RELDATE   TAG M1 AS JW1
  WHERE DATEDIF(RELDATE, TRANSDATE,'Y') GT 10;
  WHERE V1.MOVIECODE EQ M1.MOVIECODE;
END
and the AT keywword is essential for conditional joins ... it is not in your join however ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
January 11, 2012, 03:51 AM
Wep5622
That's something that's been bugging me ever since I ran into the conditional join feature - why is the syntax totally different from the usual join syntax?

It does seem to contain the same information, a different syntax doesn't seem to make sense. It just seems to add a (superfluous) FILE keyword and turns the order of columns and tables around.

I suppose we could just start using this syntax for unconditional joins as well (just leave out the WHERE-clauses). Would that have any drawbacks? An obvious one comes to mind: the Report Editor, but I rarely use that anyway (I don't like the results much).


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
January 11, 2012, 09:52 AM
bohorkez
GamP is right, but I did not want to use the new syntax for two reasons:

1. All the programs of my installation don't use that syntax (JOIN FILE AT...) so I thought that maybe the conditional join is performed in a different way

2. Previously of my JOIN, I declared another conditional JOIN just using one WHERE (as Francis said) and I didn't get that messagge.

But I going to try the new structure of conditional JOIN and post what I get.

Thank you


WebFOCUS 7.1.4
Windows, All Outputs
January 11, 2012, 09:58 AM
Francis Mariani
I missed the AT issue.

AT - Links the correct parent segment or host to the correct child or cross-referenced segment. The field values used as the AT parameter are not used to cause the link. They are simply used as segment references.

You must use the AT.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 11, 2012, 05:51 PM
bohorkez
As you guys suggested, I used this structure to perform my JOIN:
JOIN FILE PROMOTION AT PRO_COD  TAG V1  TO ALL
     FILE PDISCONT  AT PDI_PRO  TAG M1  AS J4
     WHERE (M1.PDI_IPC  EQ 'L');
     WHERE (V1.PRO_FFV  EQ M1.PDI_FFV);
     WHERE (V1.PRO_DATE EQ '&WK_DATE');
     WHERE (V1.PRC_PRO  EQ &WK_DEP_PRO);
END

Now I'm not getting the messagge.
Hope it helps someone with the same problem.

Thank you


WebFOCUS 7.1.4
Windows, All Outputs
January 12, 2012, 06:03 AM
j.gross
If a single WHERE is supported, just combine the several conditions into a single (equivalent) WHERE phase (as you would for SQL) --
   WHERE (PDI_IPC  EQ 'L')
   AND (PRO_FFV  EQ PDI_FFV)
   AND (PRO_DATE EQ &WK_DATE)
   ;