Forum Academy Marketplace Showcase Pricing Features

How to count common elements in two fields of the same table?

Hi everyone,

I’m just starting with bubble. I’m struggling to do something which seems to be easy but I don’t find the solution.
I have a table “score_calculation” with two fields “skills_job” and “skills_upload”.

“Skills_job” is of type text and contains texts separated by coma: Programming, Decision Making, Data Analysis, UX research, marketing.
“Skills_upload” is of type text and contains also texts separated by coma: marketing, UX research, prototyping, UI design.

My question is: how can I get the number of common elements (marketing and UX research => 2) on those fields and show it?

Thank you

You need to use Sklill jobs: intersect with:Skills upload:count

I tried but it gives 0.

image

In debug mode, click inspect and check each part. Be sure privacy rules are not preventing getting results

I checked the permissions and it’s okay.
I found something : when the entry is done by app admin the formula works. But when it’s the current user, it fails.

Do you know how can I resolve that?

Can you share the WF where you set the skills jobs and skills upload?
Also, can you open the second item in DB with the pencil (created by user) and post a screenshot?
Thanks

here is the WF:

The main issue is there. You don’t set your list correctly. This is actually a single item with all items separated with a comma.
You need to use Set list or Add list depending of your case in your WF if the user can select multiple items. When they select only one, you can use add (that is for a single item).
Change your WF to set list or add list and it should work after.

I tried Set list and Add list and I got blank in both case

Sorry. I can see that in your WF, you are using a search. Can you share more informations about your page settings (are you using a multi dropdown?)

No, I’m not using multi-dropdown. I want to show it on a text element.


For the WF:
-the UserProfileSkills data looks like this

image

and
-the userjobselection data like this


I mean that, when user select the items, are you using a multidropdown?
The part that is not working is before the display. This is when you set the field. So from where and how you get and set data into theses two fields.
If you wan’t to set a list, you need to use set or add list, but you also need to provide a list. When I look at your “skill_job” add screenshot, I can see Search for userjob selections last item’s skill. This mean that you add a single itme ot he list. But the Skills upload add is a Do a search for user skill that is a list.

So I’m trying to understand the process on how theeses fields are set because the issue is there.

I see what you mean.
This is how I add the skills to the userprofileskills data
image
And I create a thing in the WF when the users clicks on add a skill

Ok. But how this data is added to the user profile skills? From the RG data?

No, like this

I don’t understand your WF

From where the user fill the two fields for skill_job and skill_upload fields?
The first screenshot show that you was using “add” for theses fields. In this screenshot, you was using a Do a search. On what is based the do a search?
I can also see that “User Job Selection” have a skill field. This is a single text field. Does it mean that the User Job selection only have one skill?

Skill_job and skill_upload fields are not filled by the user. Let me explain a little bit the global structure of the app so it could be clearer.

The app works like this:
Step 1- The user enters some skills. When he cliks on “add a skill” it adds a new line in the “UserProfileSkills” table. There’s a next button which navigate to a new page called “advanced search”

Step 2- In the “advanced search” page, he can look for a job by typing the title inside a search bar or by choosing the “skill”, the “diploma” and the “Industry” in

Step 3-the user gets a list of jobs, choose a job and click on an icon (the 3 vertical dots in the RG) to see the details in a job_description page. When he clicks on this icon, it adds a new line in the “UserJobSelection” table from the RG.


At the bottom of the job_description page, he has a button “test my skills”. When he clicks on this, it starts a quiz with x questions.

Step 4 - On the last page of the quiz, there is a button “Next”. When it’s clicked, it creates a new calcul_skills_score thing (I use add instead of add list or set list which gave blank values)

and goes to a new page called “resultat” .

At this point, the calcul_skills_score contains texts separated by coma in skills_job and skills_upload columns.


Step 5 - Finally on the resultat page, I would like to get the number of skills in the “skills_job” column which match those on “skill_upload” and convert it in percentage. That’s the starting point of my post. How can I match those two columns?

It works if I add a new entry manually in the calcul_skills_score table. It shows 0 if I push the values with the button when I’m logged in as a user.

Edit: I managed to get a yes/no information if the user’s skills are among the job’s skills by using a RG.


So it gives that:
image
How can I count the number of “yes” elements in the RG?