Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6945 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am trying to import from a ODBC data source. When I create the sql statement using a calculation the Query fails. If I take the results of that calc and put them into the FM Query Builder, the Query works like a champ.

Any ideas?

Here is an example of my calc.

Let([

pr = ".";

tblcovers = Quote("tblcovers") & pr;

C1 = Quote("C1") & pr;

C2 = Quote("C2") & pr;

C3 = Quote("C3") & pr;

C4 = Quote("C4") & pr;

C5 = Quote("C5") & pr;

C6 = Quote("C6") & pr;

CoverColorID = Quote("CoverColorID");

tblCoverColors = Quote ("tblCoverColors")

];

"SELECT " & Quote("tblCovers") & pr & "*" & ", " & Quote("C1") & pr & Quote("ColorName") & " AS CoverGraphicColorName, " & Quote("C2") & pr & Quote("ColorName") & " AS CoverTitleColorName, " & Quote("C3") & pr & Quote("ColorName") & " AS CoverThemeColorName, " & Quote("C4") & pr & Quote("ColorName") & " AS SpineSchoolColorName, " & Quote("C5") & pr & Quote("ColorName") & " AS SpineTitleColorName, " & Quote("C6") & pr & Quote("ColorName") & " AS SpineVolumeColorName" &"¶" &

"FROM " & tblCoverColors & " C2 INNER JOIN" &"¶" &

"tblCovers INNER JOIN" &"¶" &

tblCoverColors & " C1 ON " & tblCovers & Quote("CoverGraphicColor") & " = " & C1 & CoverColorID & " ON " & C2 & CoverColorID & " = " & tblCovers & Quote("CoverTitleColor") & " INNER JOIN" &"¶" &

tblCoverColors & " C3 ON " & tblCovers & Quote("CoverThemeColor") & " = " & C3 & CoverColorID & " INNER JOIN" &"¶" &

tblCoverColors & " C4 ON " & tblCovers & Quote("SpineSchoolNameColor") & " = " & C4 & CoverColorID & " INNER JOIN " &"¶" &

tblCoverColors & " C5 ON " & tblCovers & Quote ("SpineTitleColor") & " = " & C5 & CoverColorID & " INNER JOIN" &"¶" &

tblCoverColors & " C6 ON " & tblCovers & Quote("SpineVolumeColor") &" = " & C6 & CoverColorID &"¶" &

"WHERE (" & tblCovers & Quote("CoverID") & " = 14)"

)

and here is the result of the calculation.

SELECT "tblCovers".*, "C1"."ColorName" AS CoverGraphicColorName, "C2"."ColorName" AS CoverTitleColorName, "C3"."ColorName" AS CoverThemeColorName, "C4"."ColorName" AS SpineSchoolColorName, "C5"."ColorName" AS SpineTitleColorName, "C6"."ColorName" AS SpineVolumeColorName

FROM "tblCoverColors" C2 INNER JOIN

tblCovers INNER JOIN

"tblCoverColors" C1 ON "tblcovers"."CoverGraphicColor" = "C1"."CoverColorID" ON "C2"."CoverColorID" = "tblcovers"."CoverTitleColor" INNER JOIN

"tblCoverColors" C3 ON "tblcovers"."CoverThemeColor" = "C3"."CoverColorID" INNER JOIN

"tblCoverColors" C4 ON "tblcovers"."SpineSchoolNameColor" = "C4"."CoverColorID" INNER JOIN

"tblCoverColors" C5 ON "tblcovers"."SpineTitleColor" = "C5"."CoverColorID" INNER JOIN

"tblCoverColors" C6 ON "tblcovers"."SpineVolumeColor" = "C6"."CoverColorID"

WHERE ("tblcovers"."CoverID" = 14)

This topic is 6945 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.