Is it possible to "Add on the fly" based on a condition?

I have a form where I’m needing to add a vehicle on the fly from a field but the Add capability should only be available if another field in the row is set to a certain value (If Receive From = Trailer).

I tried creating 2 slices - one that allows Add and the other does not allow the Add. At the Vehicle (Truck) field, I kept the Source table as the name of the table but updated the Valid If to the following:

IF([Receive From]=VEH_TRAILER,
SELECT(
vehicles_add[vehicle_rec_id],
OR(AND([Division]=[_THISROW].[Division],[Type]=[_THISROW].[Receive From],[Status]=Active),[vehicle_rec_id]=“OTHER”)
),
SELECT(
vehicles_no_add[vehicle_rec_id],
OR(AND([Division]=[_THISROW].[Division],[Type]=[_THISROW].[Receive From],[Status]=Active),[vehicle_rec_id]=“OTHER”)
)
)

It unfortunately still includes the “Add” button when user presses the Vehicle field regardless of the slice we use for validation. Any ideas?



List returning valid_if expressions do not inform the column as to which table or slice it should point to (which in turn affects the ability to add). They only act to return a list of key values. You have to manually specify a table or slice for each column.

You could have 2 columns of the same thing, with the only difference being pointing to a different table/slice, then hide or show those 2 based on your condition.

3 Likes

Thanks Marc! I’ll give it a try.

1 Like