Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Trying to wrap my head around ExecuteSQL().  I haven't used it enough to be fluent in it yet.

 

I have a calculation in the Classes table to count the number of boats in a region:

ExecuteSQL(
"SELECT count ("OwnerID")
FROM "Class Member Data"
WHERE
"Region" = ? 
and  "ClassID" = ?
and "ownerCurrent" = ?";
"";""; 1; ID; 1; 1
)

(ID is a field in the Classes table.)  

 

Which gives me a number, but not the same number as performing a Find for Region = 1 and ClassID = Classes::ID and ownerCurrent = 1 in a Class  Member Data layout.

 

So I want to create a list of OwnerIDs to see where the discrepancy lies to allow me to figure out the reason for it.

 

I created another calculation field

ExecuteSQL(
"SELECT"OwnerID"
FROM "Class Member Data"
WHERE
"Region" = ? 
and  "ClassID" = ?
and "ownerCurrent" = ?";
"";""; 1; ID; 1; 1
)

which only returns one OwnerID, where I was expecting a list of all OwnerIDs that fit the WHERE criteria.

 

What have I overlooked or misunderstood?

 

Posted

Are the region, ClassID and ownerCurrent fields numbers or text?

Why 4 optional variables when you are using 3?

What happens if you hard code the query into the select first?

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