Taking Value From A Field + Adding It To A Users Score

Can someone please help my addled brain? I’ve successfully managed to have a user create a code and assign that code a value, so ABCD24 is worth 10. I then can show a RG with the codes and their values. Separately I want anoth user to input into a field ABCD24 and then have 10 points be added to their Total score. Were I’m falling down is that I have a Data thing called Code which has the code and the value fields in it. When I create the workflow to add image the value of the code to the users Total Score it’s not playing nicely. No doubt my logic is as flawed and erroneous as the last 20 years of my life.

Any help will be greeted with disco music and mirror balls! Thanks.

Hi @Tony_K, I assume that you have a field called ‘value’ on the Code data thing? You may just need to click on ‘More’ in the expression in your screenshot and add “'s value” to it.

Otherwise, you should check that your value field’s type is number and that the Total Score field on the User data thing is also a number.

Make sure input punchcode is of type decimal

Thank you, yes that’s correct I will try that!! Thanks for all your help

Ah, OK, I will check. But out of curiosity why would it need to be decimal as opposed to number?

Hmm, I’m struggling here. image Nothing seems to be working, I’m struggling to understand how to basically target a specific code’s value

Sorry for being so dense, but someone could put me right.

@Tony_K, try adding :first item after your search (Search for Codes:first item’s Value)

A database field has type of number but input box has different content types - decimal is a content type.

The database field and the input you are adding it to have to be the same type.


I will try that, thank you.

Aha! Thank you very much for that clarification.

That just adds the value of the first item, whereas I need it to add the value of the same code that is being entered into the ENTER CODE input:

OK, so first off, thank you to all who have chipped in to help, can’t tell you how much I value and appreciate your time, massive thank you.

I cracked it, as in got it to do what I want for now, and I think I understand,. I’ve basically created a state so that when you register a code and a value it creates a state called codeValue which the same as the value, then when you enter the code, it adds the result of the state to the total of the users points!!

Not sure if that will help anyone, but there you go. Cheers all.!!!

Are you specifying the parameters in your search? If you don’t specify the search parameters, Bubble will grab the first item in the list of Codes no matter what.

Inside your Do a search for Codes you should have a parameter that is something like 'code = ENTER CODE’s value".

You are actually filtering down to only one result through your search but Bubble is still seeing it as a list. The ‘:first item’ operator, in this case, is simply telling Bubble to treat the search result as a single item instead of a list.

Here’s a quick example:

If you like, PM me a link to your editor and I’ll set it up for you so you can see exactly how it works.

Hi Eli, thank you. Not sure how to share editor but will. Try and do this in the morning. Much appreciated.