Column Required If Expression in Context to View Type

I have a Column [Amount_Pumped] in a table called WaterUseData. There are three ref views in the UI WaterUseData_Detail, WaterUseData_Form, and WaterUseData_Inline.

I have an action button that creates a new entry in the WaterUseData table (ideally this record should have null for [Amount_Pumped], then it links to the WaterUseData_Inline view with the last created record in a table with quick edit enabled. At this point I would like the [Amount_Pumped] column to be required and the user should not be able to navigate away from this view before providing a value in this column.

Is this possible? I have tried this to no avail.
IN(CONTEXT(“ViewType”), LIST(“Inline”, “Form”)) as the required if expression for [Amount_Pumped]

You’re wanting a record to be created by the system, with a field set as blank, but then when the user gets transferred to the quick-edit inline/table view, the same field should be required. Correct?

I’m not sure if this is possible, but have actually been setting up almost the exact same situation, but haven’t yet gotten that far. My thought is to set required_if to CONTEXT(“Host”) <> “System”

I also don’t believe “Inline” is one of the "ViewType"s that CONTEXT uses. I think it has to be “Table”.

Yes, that is exactly what I am attempting.

Thanks for the initial idea. I will see if that will get me any closer.

It is quite possible that quick-edit in a table just won’t obey the requirements at all.

I had it working for a quick moment but then it seemed to have stopped working. Either way it appears that if you click the ‘Close’ button at the top left once in quick edit mode it will not obey the required if either.

I just tested the situation for myself. It seems that requirements/validity do not take effect in quick-edit mode for existing values. That means if the column is required, but starts off blank, going into quick-edit mode without changing the column, you can save it. Or if the column value doesn’t meet a validity requirement, if it is already there, then you can still save from quick-edit mode if you don’t change it.

Here I hard-set this column [Value] as required. I then added a record directly into the spreadsheet, synced the app, then opened that table as quick edit and the following gif shows what I get. The bottom row is one I just added into the sheet. You can see that the column can remain blank, until I put a value in there and then try to delete it.

3X_a_8_a883c878d6d3e4222533a4afd0e188fd823f08f3.gif

I then tried to turn reset_on_edit on, but it doesn’t seem to take affect for quick-edit mode either. Then I thought about putting an initial dummy value in. I set a valid_if to:

OR(> CONTEXT(“Host”) = “System”,> [_THIS] <> 911> )

Then set the value to 911 directly in my sheet and tried again. Still, opening quick edit, the existing value meets the validity check, although you can’t enter that value in anywhere.

3X_f_d_fd759bcea63f07844dc355e7dae7c9120eb2a60b.gif

So I guess my suggestion here is to set an initial value of some dummy value that is obvious that it needs replaced, and trust that your users won’t just leave the dummy value there. Something like “REPLACE_ME!!”, or “REQUIRED” or whatever you want or makes sense for your application.

This situation might also make for a good feature request.

Marc_Dillon:

CONTEXT(“Host”) <> “System”

Server, not System.

Marc_Dillon:

also don’t believe “Inline” is one of the "ViewType"s that CONTEXT uses. I think it has to be “Table”.

Correct.

1 Like