January 19, 20196 yr I feel like the answer is right in front of me, but I can't seem to nail it. I keep getting a syntax error. Here is my calc (testing in the data view for now): Let ([ theDate = Totals_Daily::Daily_Totals_From_Date ; ID = Totals_Daily::ID ; query = "SELECT SUM (Daily_Qty) FROM Totals_Daily WHERE Daily_Totals_From_Date=? AND ID=? GROUP BY Daily_Totals_From_Date,ID" ]; ExecuteSQL ( query ; "" ; "" ; theDate ; ID ) ) If I remove the second parameter (ID) and simply sum by the date, I get a result. As soon as I add the "AND ID=?" I get a syntax error.
January 19, 20196 yr ID is a reserved word. Try escape quoting the "name": WHERE Daily_Totals_From_Date = ? ( AND \"ID\" = ? )
January 20, 20196 yr 10 hours ago, beverly said: ID is a reserved word. ID is not listed as a reserved word in the documentation, and I encountered no problems using it as a field name without quoting it: 10 hours ago, filemakerdeveloper40 said: Here is my calc Could you provide a description of the fields referenced in the calculation? Or even better, upload a small demo file, so we can reproduce the problem. Edited January 20, 20196 yr by comment
January 30, 20196 yr is it possible that the value is cast from a number to text or vice versa since the ID is set to a let variable? perhaps put the fields directly as arguments in the sql vs converting them to let scoped variables?
Create an account or sign in to comment