getSize()

Hello,

I have a table with group_names and a table with groups. In groups I save a bunch of record IDs for a given group_name. Now I want to be able to tell the user, how many entries there are for a single group_name (so doing a count(*)).

I have a field member_count that uses getSize over the relation to groups. That gives me 40 every time a group has more than 40 members. In formulas I don’t have access to the DatabaseManager, so I can’t do a count (*).

The only way I see right now is to run a method onShow of the groups form, that retrieves the counts for all groups and then walks through the groups and inserts this value manually. That is not so nice.

Any ideas?

A nice enhancement would be if we could use aggregations on relations!

Thanks, Patrick

P.S. I know you Servoyans don’t like those “expensive” operations, but sometimes they are useful and if it takes too long it’s not your fault, is it?

Hmm, if I understand you correctly, I think I ,quite innocently, just did what you say can’t be done :)

I have table assignmets and table mtomStudents.
So an Assignment can have many students. In order to see how many students where given an assignment i :

define the relation Assignment.ID to mtomStudents. ass_id (couldn’t resist that one)

  1. defined an aggregation (count PK in students) field in mtomStudents
  2. placed in a form based on Assignment the aggregation field

and presto

functioning without problem

HTH

thanks. that works.

I still think that aggregations over relations would be nice. Because what we do here is actually a bit confusing…

I think that’s the part of your mail I’m not understanding.

Isn’t the solution I gave “working over relations” ?

Please enlighten me

THX

Yes, of course. But basically the information you want reads like this:

Give me the count of a related set.

So you would go to the table of the left side of your relation, go to aggregations, hit new and select count(relation.field). That’s it.

That’s what I meant.

aha , I sea what you mean. :idea:

but, I think that your solution would be “weaker”, not stronger.

If I read you correctly, your “related” aggregation would only work over the relation for which you created it.

The way it is now the aggregation will work over “any” relation that involves the many table

I am not saying that we should take one solution for the other… Both are useful :wink: