Forum Documentation Showcase Pricing Learn more

Returning :sum & :average calcs on selected groupings of the database of users

Hi all.

I’m creating an app that will help artists and musicians with their royalties. It involves some pretty heavy calculations to make it work (which I’m fine with), but I need to make a sum calculation on a collection of a few of the artists on the database - but not the whole database - and I can’t seem to do this? Please help!

For simplicity whilst I build a test/development app, I have a test database of just 20 example artists for now, below left, arranged descending with artists with the highest score at the top.

I can return individual scores for any artist, (item#, or first/last/random item, etc) but what I can’t find a way to do is to return the sum of, say, the 2nd through to the 5th artist?

How can I create a :sum on the 2nd, 3rd, 4th and 5th artist scores?

Thanks for any help

Can you have some constraints on the search so that you only have the artists you need in the list? Then, doing the sum would be fine.

I’m not sure…? How would I do this? When I search Users as a, I get the red ‘bad request’ issue, stating “dynamic data in text boxes must be printable as text, but this is a List of Users”. What am I doing wrong?

In essence, I need to be able to request the sum total of all the scores, starting at whoever is in 2nd position through to whoever is in 5th position.

The artists identities as such would not be known to the searcher, and as a privacy protection issue, would not be revealed.

Thanks again, Emmanuel

That message is there when you’re not having the right type. In this case, you have a search constraint that is on a text field, but the value you’re setting is a list of users. I don’t know what the search should be based on, it depends on your app, but you have to think about the value you want the constraint to have, and it should be a text.

Can you maybe post a screenshot or something, it’s hard to help like this.

Thanks. I’ve set up the essentials in the forum app



Thanks for posting this, that’s great. So if I understand well, you’re issues is that you would like to say:

sum all user scores that are ranked between A and B, in this case, A and B being variable. In this case, it is 5%*20 and 25%*20. and the issue that the 20 is a variable. is that right? If 20 isn’t a variable you could just sum each user one by one, it’s a bit tedious, but could be doable.

If that’s the case, we probably need to add a feature. Probably not too bad, but i want to confirm i got this right first.