[Solved] Inserting calculations in dynamic data

I am trying to get some text to read that there are # number of attendees coming to a party, and for it to calculate that from a couple of fields in my database, namely those having replied as yes, and the number of guests they themselves are bringing.

For example, it could read:
There are currently 23 guests coming

I seems to be having 2 problems.

The first one is as follows. I put in:
Search for user;
Attending = “yes”
:count

but this returns 0

The second issue is that when I try to get it to do a search for “Number in party”, I can’t even get it to finish the phrase without it throwing an error.

Any help with this is much appreciated!!


Hi there, @StandUp… the first issue could be related to the default privacy rule on the User data type, so check that and see if you can at least get past that issue.

Best…
Mike

1 Like

Hi Mike, I have updated the privacy (I had it partially done before only).

Now it is set so that everyone else can view the user’s name, whether they were attending, number of guests, etc.

It is still returning 0…

Are you allowing everyone else to find users in searches?

By the way, I am not necessarily suggesting you do what I mentioned above because I try not to make privacy rule suggestions to folks. I am simply pointing out that privacy rules are likely the issue here, and you need to remove/change the rules to meet the needs of your app while still keeping your data secure.

1 Like

Yes, I am allowing everyone else to find users, and that works for what I am creating.

There is a feed, and everyone can see everyone else’s number of guests they are bringing with them. I can see that they can see those details, so it seems the privacy part is ok…

1 Like

The problem remains with the showing of those details within this formula though.

So, I can:
Show the number of guests each attendee has (in another box),

but for some reason, I can’t either:
Work out the total number of attendees, or
Show the total number of guests. the answers to which I would then add together.

Hello Stand up, yo get that done simple and clean.
Crate a data type for event,
Field that maybe needed
Are…
Event_name
Event_date
Event_venue
Attendance
e.t.c

Now the Attendance should be type user and it should be list field,

Now on the repeating group displaying list of events add a button there for user to click if he/she is going to attend the event, if the user has clicked the yes button, the workflow should be make changes to Current cell event by adding the current user on the Attendance field by using the “add” syntax.

Now to know the numbers of user that will attend a particular event,
You will use the current event Attendance count.

This will definitely help.

1 Like

Hi, so I went back to the privacy. Turns out I was being a numpty and hadn’t fully removed the relevant privacy, I must play around with that a bit more to understand it better, but Thank You Mike for pushing me on it, I now can show the total attendees. First part, [Solved]!

Abi, I can see how that would work to also give me a count of attendees, thank you for your suggestion, much appreciated.

+++

Now, the last part of this that I still cannot do is count up the total of the attendees’ guests.

I now understand that “Number of guests” is understood by Bubble as an arbitrary field name, so counting those up just gives the total number of attendees who are bringing guests, i.e. have filled this field in.

What I can’t work out is how to get Bubble to add up the numbers that are in that field in the database…

Yup, I knew it was still privacy rules… it almost always is. :slight_smile:

Try something like Search for Users:each item's Number in party:sum.

1 Like

Hmm, when I do that, it tells me to
“Search for Users: remember to fill out the constraint type”,
and putting in :sum there turns it red and deletes when I move off the box.

I can put in =, but then it tells me to
“Search for Users: remember to fill in the value”

No, I meant get rid of the Number in party constraint on the left (although, you might need a constraint for Attending = "yes") and construct the expression in my last reply in the field on the right.

1 Like

Mike, you are a genius! Thanks, it worked

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.