Focal Point
[SOLVED] Receiving Error: Join FROM Fields belong to different segments

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

March 30, 2020, 02:44 PM
Brandon Andrathy
[SOLVED] Receiving Error: Join FROM Fields belong to different segments
Hello,

I am trying to join a hold file up to my master file (synonym) two separate times to different portions of the file.

I get the error "JOIN FROM fields belong to different segments :

As far as pseudo code goes, here is what I'm trying to do.

 
TABLE FILE CAR
SUM
  DEALER_COST
BY COUNTRY
ON TABLE HOLD AS 'H1'
END

JOIN INNER _ADM_STAR.FACT1.COUNTRY IN _ADM_STAR TO COUNTRY IN H1 AS J0
END
JOIN INNER _ADM_STAR.FACT2.COUNTRY IN _ADM_STAR TO COUNTRY IN H1 AS J2
END
 


Does anyone have an idea how to solve this?

This message has been edited. Last edited by: Brandon Andrathy,


WebFOCUS 8204
March 30, 2020, 02:57 PM
FP Mod Chuck
Brandon

I think you need an END after the first join and I also think you need an IN in the second join to tell it which file you are joining to.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
March 30, 2020, 03:01 PM
Brandon Andrathy
Hey Chuck, thank you for your reply. I modified my original post. I have both of those things in my query. Typo here Smiler.

Thanks in advance for additional help!


WebFOCUS 8204
March 30, 2020, 03:06 PM
FP Mod Chuck
Brandon

Seems like you are going to have to have two separate reports one for each join. You can create two new hold files to generate the final report.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
March 30, 2020, 04:01 PM
Brandon Andrathy
Hey Chuck,

Thanks again for your response!

Is there any other solution to this? I tried to make them as separate SQL Scripts and also tried a JOIN Clear on a separate hold file and that didn't work.

If I try to put the reports as separate .fexes, I'd still need to join them up. Hoping there's another way to get around this.


WebFOCUS 8204
March 31, 2020, 07:23 AM
MartinY
Sure that we are missing several information such as how _ADM_STAR is organized, but seems that the error comes from there.

Are you able to run (pay attention that I have INDEXed the HOLD table
1- With only first JOIN & its fields ? Run as is
2- With only second JOIN & its fields ? Invert the commented lines
3- With the whole thing ? Remove all comments
TABLE FILE CAR
SUM DEALER_COST
BY COUNTRY
ON TABLE HOLD AS 'H1' INDEX COUNTRY
END
-RUN

-*-* For first test run
JOIN INNER _ADM_STAR.FACT1.COUNTRY IN _ADM_STAR TO COUNTRY IN H1 AS J0
END

-*-* For second test run
-*JOIN INNER _ADM_STAR.FACT2.COUNTRY IN _ADM_STAR TO COUNTRY IN H1 AS J2
-*END

TABLE FILE _ADM_STAR
SUM 
-*-* For first test run
    J0.DEALER_COST
-*-* For second test run
-*    J1.DEALER_COST
-* For first test run
BY FACT1
BY J0.COUNTRY
-*-* For second test run
-*BY FACT2
-*BY J1.COUNTRY
END
-RUN

I do this often to JOIN twice to the same table. If it doesn't work it may be related to the parent table _ADM_STAR


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 01, 2020, 09:09 AM
Brandon Andrathy
Hey All,

I got this to work. thank you very much for your responses!!

Chuck, you were right. Once I was using the same Database, this error went away and I separated out the different fact queries.

Thanks a ton! I'm gonna go ahead and close this


WebFOCUS 8204