+1 to a field of a particular row in a database

Hi,

I want to add a +1 from the interface into a particular numeric field of a particular row in a database. NOT the first item (which seems to be the only thing that works!). Why isn’t this easier to achieve?

Issue

I tried doing a “search for”, finding the dB name and specifying the UniqueID, but this results in red text of death. This technique has worked well for accessing particular fields, but doesn’t seem to work for modifying a field.

Any help is much appreciated.

Hi @GoonerJon,

There are several ways you can do this, but it depends on how your interface works. Are you showing a list of Apps to your users, and you want them to be able to add a +1 to an app of their choice?

Searching for something and constraining it with UniqueID should also work, what kind of error are you seeing in the Isse Handler?

Hi @petter thanks for the reply.

It’s a bit like an App store - each App feature (image, info, website link) is housed in a normal group. A hover in one part of this group then results in a GroupFocus being displayed. Inside that are 5 star icons. The action to write +1 is attached to the clicking of e.g. Star 1.

In the Apps database, each App has its’ own entry (so each App is a row in the dB). The “1 Star” is a field.

Let’s say I have 2 Apps (so 2 rows in the dB) - how do I specify that the +1 has to be for App number 2’s 1 Star field?

When I try using UniqeID this is the error:

The only way I can get rid of the error is by specifying “First item”.

Each of your app features are contained within a normal group. Is this group contained within the cell of a Repeating Group, or are you manually listing the apps in different regular groups?

The GroupFocus’s Type of Content can be set to App, which is what you would reference when you want to save the new vote. This can be a bit tricky in repeating groups, but it is doable.

If you have a link to your app, it’ll be easier to see what you mean, and might same us some typing :slight_smile:

No the group housing all the individual App stuff is just inside another normal group.

I did set the GroupFocus to App I believe but will double check this…

Seeing the illustration you just added, you will need to add :first item at the end of the Search for apps to specify that you want to edit that particular App.

Right now, you’re giving Bubble a list of apps (even if the constraint you have will only return one app, it’s still technically a list)

Oh…So First Item won’t just pick the first field in that particular row?

It will pick the first item in the search result you are producing. So in most cases it will depend on how you are sorting the results. In your case, as you are specifying a unique ID, the list will always produce just one result. So you can safely use first item to “convert” the result from a List of Apps, to one App.

1 Like

Ahhhhhh! D’oh! My assumption was first item related to the underlying dB, not the search. Thanks so much for clarifying!!

No worries, glad I could help you out! :metal:

1 Like