Best practice for sending checkbox values on WeWeb form to Baserow Multiple Select field

I have a form in WeWeb with a list of checkboxes. On submit, I’d like to send these values to Baserow and store them in a multiple select field. I was able to accomplish this, but I’m new to WeWeb and this took quite a bit of bumbling. I’m curious if this is a reasonable approach or if there are simpler ways to go about this.

Unfortunately, since this is my first post the forum will only allow me to add 1 image. I’ve uploaded screenshots of each step to this Google Drive folder for reference.

Here’s what I did:

  1. Created a variable to store each checkbox value. For example, a variable titled “Apples”, set as a number, with a default value of 0.

(See Screenshot2)

  1. On the checkbox, I added a workflow to detect a change to the checkbox.

(See Screenshot3)

If the checkbox value is true, it assigns a value to the variable that matches the value of the option in Baserow. For example, if the Apples checkbox is selected it assigns a value of 1717404 to the Apples variable.

(See Screenshot4)

I repeated this for all checkboxes. So each checkbox has it’s own variable. Each checkbox also has it’s own workflow that detects a change in the checkbox and either assigns the corresponding Baserow value (if it’s checked) or 0 (if it’s unchecked).

  1. I created a new variable called Favorite Fruits, set as an Array.

(See Screenshot5)

  1. In the form submission workflow, I add a step to create the Favorite Fruits array after submit but before making the Baserow REST API request. This uses the createArray formula to list all the values. I also add a filter to filter out the 0 values.

(See Screenshot6)

  1. In the REST API request, I add a field where the key is Favorite Fruits and the value is the Favorite Fruits Array variable.

(See Screenshot 7)

Since I’m new to this process and I’m still learning concepts like variables/workflows/etc I’m hoping to learn if this is a reasonable approach or if there are alternative/simpler ways of accomplishing what I’m trying to do.

Thank you!

P.S. I’d also love to hear if this was a good way to ask this question or if there are better ways to show what I’m doing and ask for help!

you can use only the favourite fruit array. create a global workflow that takes a text (the baserow id) and a boolean (to signal if it is an add or remove operation). in the workflow add the text parameter (the id) if it is an add operation otherwise remove it.
on every checkbox on the change workflow execute the global workflow, for parameters use the id of the corresponding object in the checkbox, and the add/remove boolean based on the status of the checkbox

you can keep your logic as is, but instead to have separate variables you use an object (empty at first). when you add a fruit you add a property to the object (with a partial update) where the key is the baserow id and the value is true. same thing but with false when a fruit is deselected. like the previous example you can have this logic in a global wf. then on submit you can create the array feom the object. this way you don’t need to create single variables for every checkbox

Thanks so much for this! This was really helpful.

I was able to get this working with one modification: I realized that I didn’t specify that the array needed to be an array of integers.

All I did was update the key/value for each item in the object so:

  • If a checkbox is selected, the key/value is “Baserow ID” = BaserowID
  • If a checkbox is unselected, the key/value is “Baserow ID” = 0

Then I add the values to the array with a filter to remove the 0 values. Thanks again! I learned so much with this. I have several forms with checkboxes in this application, so having this method with a Global workflow and no individual variables for each checkbox is going to make things much easier to maintain over time.