Application with optional "Record Selector" elements

I just updated to 1.33.3 and it seems to have broken my previous workaround for Record Selector elements.

I have a bunch of record selectors, all of which should be optional. The workaround previously was to set their default value to 0, and on the Application page, they show as Record 0 unless you select something else.

Pressing a button would update a row, and record selectors which were left empty (Record 0), would set the appropriate field to nill, or empty, or whatever the proper term is for “blank”.

Now my application just throws an error in the upper right, “one of more fields contain invalid values”.

The only way to successfully submit the form is to fill in all record selectors.

Is there any other way to work around this?

If I downgrade to 1.33.2 will I experience any problems?

Thanks!

I’ve narrowed my problem down and almost fixed it… But not quite.

The good news is all I had to do was change the default value from ’0’ to just leaving it blank.

This lets me use the placeholder text more effectively, and I also just figured out my old method was adding fantom blank rows, so that’s solved now.

I still have a problem with two of my Record Selectors, though. Leaving them empty and trying to use an ’Event’ to ’Update Row’ doesn’t work if they’re empty in the app, so I’ve worked around it by giving them their own buttons.

The two in question both try and pull the row number of whatever is selected, then update that row with new info. If the selector is blank, updating the row fails and no other events fire.

Hey @walden, I’ve shared this feedback with the Application Builder team to review :blush:

Hey @walden thanks for the feedback. Could you give me a bit more context about what you are trying to do exactly and what blocks you?

What I understand so far is that you have record selectors for link row fields in your DB and you are not able to update a row with blank values?

Are the record selectors supporting multiple values on single values? Have you checked the ‘Required’ property? Could you send a screenshot of the configuration of the update row action?

In my Application, I have a bunch of Record Selectors. They are all optional for the users to fill in.

There was a Button at the end that fired off 6 different Events. The events include Refresh data source, Update row, and Create Row type events.

There are two different Update Row events - one of them works great with empty values, and the other is causing the problems.

The Update Row that works updates a fixed Row ID (1).

The Update Row that doesn’t work attempts to update a Row ID based on what’s selected in a Record Selector.

If something is selected in the associated Record Selector, it updates the correct Row ID and works great.

If nothing is selected in the associated Record Selector, the empty value seems to make the Update Row event fail, because it doesn’t know which row to update (since it’s blank).

Previous to 1.33.3 (and I’m sorry but I don’t remember exactly which version I updated from, but I have only been using Baserow for about a month so I think I upgraded from the previous version) I had to use a Value of 0 in each Record Selector, so if nothing was selected, it told the Update Row event to update Row 0. Row 0 doesn’t exist, so it would create an empty row and move on to the next Event. No errors, but the byproduct of empty rows in the table.

The Record Selectors are set to single value, Required is not checked.

My workaround for now is to create a new Button that the user only presses if it’s needed. The other Button which used to have 6 events now only has 4 events which don’t fail.

Ideally, my single Button would be able to fire off all 6 events to make things a little easier for the users to understand.

Thanks! Happy to provide any more info you need. In fact, if you want to play around with it I have a test page set up here. The username is change@me.com and password is password. To see if fail, leave Razor empty and click the blue button named Click to stage razor info....

Hi @walden - I’m not able to reproduce the error as you’ve described it. Here is what I tried:

In the Database builder, I created a table called “Fruits” with one Text field. There are 3 rows: Apple, Banana, Cherry:

In the Application builder, I created a Record Selector element. In this element, I set the value to 0:

I also created a Button element with an Update Row action:

I then previewed the application, left the Record selector empty, and clicked the submit button. When I do this, I notice that a new row is created in my table:

If I click again, another row is added.

The only way I can reproduce your error is if I leave the Record selector’s value empty. This results in an error. The actual error in the network response (if you inspect via browser console logs) is:

{
    "error": "ERROR_WORKFLOW_ACTION_IMPROPERLY_CONFIGURED",
    "detail": "The workflow_action configuration is incorrect: The result of the `row_id` formula must be an integer or convertible to an integer."
}

This is an normal/expected error, since we cannot update a specific row without knowing the row ID.

Can you share a screenshot of your Record selector’s settings?

1 Like

Thanks for confirming. My record selector settings have an empty Value at the moment, which throws an error just like you said, so no need for a screenshot.

I could solve the problem by putting 0 in the Value field for the record selector, but that inserts an empty row if the record selector isn’t used which isn’t desirable for me.

In summary, what I’ve learned is:

  • Using an empty record selector in an Update Row event works as long as you’re updating a specific Row ID, and the record selector is being used to change a Field. If the record selector is left empty, it’ll update the related field to be empty.
  • Using a record selector in an Update Row event as a way to determine the Row ID needs to have some sort of Value… either the value determined by selecting something from the record selector, or a default of 0. If the default 0 is used, it adds an empty row.

Now that I’ve wrapped my head around that, here’s the real problem – if I combine all of my events into 1 button, any sort of error stops any subsequent events from happening.

By placing my error-prone Update Row event at the end, it all works. There’s a notification about the error, but that’s fine.

My problem is that I have 2 error prone events, so once the first one throws an error, the 2nd error prone event doesn’t get called.

So, I’ll consider this solved now that I’ve wrapped my head around the limitations and work-arounds. All that’s left to do is decide to how I want to handle it.

Thanks for your help!