AnsweredAssumed Answered

SQL for field definition gets Parse Error when creating an auto-enter calculation?

Question asked by BruceHerbach on Nov 1, 2014
Latest reply on Nov 3, 2014 by BruceHerbach

I'm trying to get FileMaker 13 Advanced 13.0V3 to accept the following calculation for an auto-enter calculation. This is out of SeedCode SQLExplorer version 1.3. When I try to save the definition I get a Parse Error message and the definition can't be saved. If I paste this into the data viewer, it returns the correct result. So the SQL is functional.

 

This started as an older solution for some of the fields originally started with an _ character. In an attempt to get this to work, I renamed the fields. This didn't help.

 

Any suggestion on how to get past this would be greatly appreciated.

 

----------- SQL ---------------

// Built by SQLExplorer. Compliments of SeedCode… Cheers!

 

Let ( [

 

TPA = TSK_assembly::templateID;

TPT = TASK::templateID;

 

// Define Carriage Return Substitution Character

ReturnSub = " " ;

 

// Enable the second line here if you want the header in your results

 

header = "";

//header = "a.L2_Size_Select";

 

 

// Define Table variables

aTPL_TSK_SIZE_SELECT = Quote ( GetValue ( Substitute ( GetFieldName ( Tpl_TSK_Size_select::kf_Assembly ) ; "::" ; ¶ ) ; 1 ) ) & " a" ;

 

// Define Field Variables

aAssembly = "a." & Quote ( GetValue ( Substitute ( GetFieldName ( Tpl_TSK_Size_select::kf_Assembly ) ; "::" ; ¶ ) ; 2 ) ) ;

aTask = "a." & Quote ( GetValue ( Substitute ( GetFieldName ( Tpl_TSK_Size_select::kf_Task ) ; "::" ; ¶ ) ; 2 ) ) ;

aL2SizeSelect = "a." & Quote ( GetValue ( Substitute ( GetFieldName ( Tpl_TSK_Size_select::L2_Size_Select ) ; "::" ; ¶ ) ; 2 ) ) ;

 

// Build SQL Query

q =

"SELECT " & aL2SizeSelect & "

FROM " & aTPL_TSK_SIZE_SELECT & "

WHERE " & aAssembly & " = ? AND " & aTask & " = ? " ;

 

// Run SQL Query

result = ExecuteSQL ( q ; "" ; "" ; TPA ; TPT ) ] ;

 

// Clean up carriage returns

GetAsNumber(result))

Outcomes