If I understood what you want, you might try the following:
- define a global field (gFruitName) - you can put it on the layout as pop-up
- create a calculation field - "PlotThis", defined as If ( B = gFruitName; 1; 0 )
- plot PlotThis against A
Thanks siplus. I tried it and that doesn't seem to do it.
I think this would work if I only had two categories in B, but I actually have 10 (I just wanted to keep the example simple) amongst 300 records. There's actually 14 categories in A and 10 in B. I want to be able to plot any one (or two or three) of the 10 in B against all in A. Just not all of B at the same time.
It seems there should be a way to just select the data I want in B to be plotted rather than plotting the whole thing.
I just wanted to keep the example simple
That's not always a good idea, not the least because it actually adds a level of complexity: now we have to try and keep a mental model of what you might mean, or what apples and oranges have to do with numbers…
Anyway, you can try this: assuming you have a (return-delimited, like in a checkbox-formatted field) list of categories to filter B by …
arrayOfBs = "'" & Substitute ( YourTable::selectionFieldForB ; ¶ ; "','" ) & "'" ; // assuming that B is a text field
ExecuteSQL ( "
SELECT SUM ( A )
WHERE B IN (" & arrayOfBs & ")
GROUP BY B
" ; "" ; ""
Using the “return delimited values” option of the Chart tool, this result would be your y values, while the original selection field are your x labels.
Using SUM() is of course just an example, since it is not clear (to me) how you want to aggregate the A field in the found records.
Thanks erolst and sorry for the complexity issue. I’m not really good at this kind of thing…. I’ll give this a shot.