Jump to content

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

Recommended Posts

Posted

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. 

Posted

ID is a reserved word. Try escape quoting the "name":

WHERE Daily_Totals_From_Date = ? ( AND \"ID\" = ? )

Posted (edited)
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:

 

image.png.99b64473ceb6e40ed76e46682adf1cd4.png

 

 

 

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 by comment
  • 2 weeks later...
Posted

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?

This topic is 2215 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.