Cross-compare two fields from two data type using condition

Hello folks,

I’m trying to make a workflow. The process would be:

1, compare two fields’ values. (they are both texst, and are from different types of data)

2, If it is a match ( i.e. two fields are identical text ), the user can get 1 point.
If it is not a match, do nothing.

3, there will be comparisons of 6 pairs of fields. If all are a match, then the user’s maxim point will be 6 points. If all non-match, the user will have 0 points.

4, I also created a Data Type for Point. So in the workflow, it is meant to “make change to a thing (point)” or "Create a thing ( point) " .

I was trying to create a workflow and I was trying to use conditional (if match, plus 1 point). However, I found out there’s no “=” for text comparison.

My question are

Q1 “=” only for numeric fields ? How can I compare texts ? Should I grant each text with a numeric attribute, so the system can compare the numbers behind the scene ?

Q2 Do I need to have the Expression Plugin to realize “+1” activitiy ?

Thank you as always,

Eh, Bubble can compare text data types. The equality condition you’re looking for is called “is”. (Conversely the state of not being equal to is labeled “is not”.)

For example, if text1 is the string “keith” and text2 is the string “keith”, the expression:

text1 is text2

Will evaluate to yes (true).

As for scoring, yeah just increment the score (a value of number type) by one by adding 1 to it.

Have you done the Bubble lessons?

(Also, I’m pretty sure that the folks behind Bubble feel that this sort of nomenclature is pretty much self-explanatory, but if you hover over the operator menu for a moment, you will get a link to the reference and it’ll take you here: Operators & Comparisons - Bubble Docs. You may want to give that a quick read.)

1 Like

Hi @Keith, thank you !

Yes it is kinda working now. Just at the scoring part: It doesn’t give me “+1”, it only gives me “=”. Then I used “+1”, but by default the system changed it back to “=1”. So in the end, though the user could have 3 points, the system only gave him 1 points.

How do I make it incremental ?
Thanks

In this context (where you are setting the value of a field to the existing value of the field plus 1), your assignment statement must be exactly that.

I’m not going to type out the expression you shared in your screenshot, but in the abstract:

If you want to increment Current User’s Thing’s User Point field by one, you set the value of the User Point field (as you have it in your screenshot) to:

Current User’s Thing’s User Point + 1

It’s just like in a normal programming language where, if I want to increment variable a by one, I might do:

a = a+1

In Bubble, “a” is some crazy expression you have to construct.

1 Like

Thank you so much Keith. It is working now !
Your explanation is easy to understand to someone like me having no logic or coding background at all.

Have a lovely day

1 Like

Glad I could help!

1 Like

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