Show_if constraints suddenly stopped working as they should

I have had managed to get the show_ifs working as they should, so far, until recently when they have stopped working.

The column had show_if constraints based on user roles, which was retrieved using an expression any(Profile Slice[Role]), where the Profile Slice is a slice that filters out all but the current user, and the [Role] column is the role associated with a user.

The show if was defined as:
or(any(Profile Slice[Role])=“Admin”, any(Profile Slice[Role])=“Moderator”)

One thing that I surmise might be causing the problem is that the view in which the problem is showing up is from a slice from the main table. Is that so that show_ifs don’t apply to slices?

That should work ok. Are you saying that on a different UX view this works ok? Is there a pattern of where it works and where it does not, given the exact same expression above?

BTW, your expression could also read:

in(any(Profile Slice[Role]), {“Admin”,“Moderator”} )

1 Like

I disabled the "apply show_if constraints universally’ option in forms.

Enabling it resolved the problem.

But I do want to hide some columns in form views, or other. Last time I checked, the Context thing didn’t work.

1 Like

Thanks for this. <3

It should work just fine. What expression(s) did you try?

Another option for hiding columns in form views is to base the form on a slice which excludes the undesirable columns.

My bad, I mixed up view types and stuff. Long story.

It’s working now, no worries. :smiley:

1 Like