V8S Posted December 20, 2019 Posted December 20, 2019 tbl.Products has 3 fields: Ref, Agent and Tagged. A number of Products are tagged for an export. From another layout, I want to chart, using ExecuteSQL, the Count of Ref for each Agent who has Products that are Tagged. So at present I have: X AXIS: SELECT Agent from tbl.Products WHERE Tagged is not null ORDER BY Agent ASC Y AXIS: SELECT Count(Ref) FROM tbl.Products WHERE Tagged is not null GROUP BY Agent ORDER BY Agent ASC So my chart shows an ordered. But what I want to do is ORDER BY the count, which means in the SQL I need to output two fields for each SELECT: SELECT Agent,Count(Ref) AS CountRef FROM tbl.Products WHERE Tagged is not null GROUP BY Agent ORDER BY CountRef DESC I there a way to get Filemaker to extract the Agent for the X axis, and CountRef for the Y axis?
comment Posted December 20, 2019 Posted December 20, 2019 If you're doing this within a script (as I believe you should), you can tell the same script to loop over the ExecuteSQL result and separate it into 2 variables. Please update your profile to reflect your version and OS, so that we know what you can use.
V8S Posted December 20, 2019 Author Posted December 20, 2019 Yes, that's what I've ended up doing actually. I just wondered if I was missing something.
comment Posted December 20, 2019 Posted December 20, 2019 1 hour ago, V8S said: wondered if I was missing something. In version 18, you can also use the While() function to do the same thing. And, of course, in any version you can use "native" methods (find, sort, summarize) to gather the chart data instead of SQL.
Recommended Posts
This topic is 1798 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 accountSign in
Already have an account? Sign in here.
Sign In Now