Counting number of empty fields in a data type?

When a new user signs up, they are navigated to their user dashboard. I would like to display a small notification badge on each user’s dashboard that indicates the number of empty fields they still need to complete under their personal profile section. For example, after a user signs up, they still need to add a profile photo and a contact number, therefore the small notification badge should count that there are 2 empty fields in their personal profile section. How will I go about counting or summing these empty data fields? Please help fellow bubblers. Thanks

I would add a hidden group, with a content-type of ‘number’ to use as a variable.

For its data source you’ll need to create a yes/no expression for whether each of the fields in consideration are empty or not, then format each yes/no value as a number, and add each number to the expression.

So, if your User Datatype has 3 fields you want to include (‘Name’, ‘Address’, and ‘Date of Birth’) it would look like this:

Current User's Name is empty: formatted as number + Current User's Address is empty: formatted as number + Current User's Address is empty: formatted as number

For each one, format the Yes value as 1 and the No value as 0

Then, just refer to that group’s number to display how many fields the User has left to complete.

Maybe not what you want but probably easier:

  • Have a field “field_to_fill” in your user database as a number; with default to the number of fields your user needs to complete
  • Everytime the user fills a field, subtract one

Else the solution above is probably the best for dynamic checking but might be hard to maintain if you have a lot of fields, if you’re planning on using this calculation in different places or if you plan on changing the number of required fields often

Thanks