Possible to have a User Setting that cannot be edited?

Is it possible to have a USERSETTING that should not be edited? I’m capturing the device_id but don’t want the user to edit the value.

Thanks

Yes, usersettings has Show? and Editable? just like regular columns.

I don’t really understand that error message. I’m not familiar with [_THISUSER], is that even a thing?

1 Like

Thanks Marc, sorry the delay. You’re right I have no idea where the [_THISUSER] came from. My initial settings for the field device_id is USERSETTINGS(device_id). The USERSETTING table has a UNIQUEID for the device_id initial value. Not sure where the [_THISUSER] is coming from.

Not sure why you are using usersettings on this case. Why don t you put context(“device”) into intial value for device_id field instead?

1 Like

Just did a quick test on a usersetting with Show? ON, Edit? OFF, and UNIQUEID() as Initial Value. It worked fine. However, a user has to actually go into the “Settings” view at least once (and Save) for this value to populate, and it seemed that a visible but not editable setting column did not make the “Settings” view show up in the menu. I had to add a 2nd setting column to get it to show up.

I proceeded to test pulling this value into a column via expression. Which also worked fine, and have discovered that

[_THISUSER].[option 2]

Seems to be equivalent to:

USERSETTINGS(“Option 2”)

Perhaps an internal alias that was never documented?

2 Likes

Interesting. I would be ok with the value not showing at all in Settings but existing in the background - just can’t seem to get the error to go away as it stops functionality.

May need to send this one off to support.

Thanks Marc!

I’ll give this a try. Thanks Tsuji

I just quickly tested, it should work…

you don t need to get the usersettigs engaged in your case, I hope.

To clarify the [_THISUSER] syntax, that is an internal representation that USERSETTINGS() gets mapped into. Ideally this would not leak out into the error messages.

Internally, there is a user settings table with a single row in it and the expression is a dereference to that row.

2 Likes

Got it. Which would be most efficient in this case: USERSETTINGS() or CONTEXT()
or are they equivalent.

Thanks Praveen

Use USERSETTINGS() rather than [_THISUSER].

Usersetting does have a limit of its capabilities for now, such as

  1. max number is just 10
  2. can not be used for a slice
  3. Can not change the order
  4. Can not change usersetting value through the actions

etc.

And recently , I noticed that deref does not work neither on usersetting.

For instance, we have usersetting REF type.

Prepare another usersetting ,read-only, which is just pull the value from another usersetting, using . i.e deref.

Refer to second usersetting in other place where we are able to use the expression.

Unfortunately 2nd usersetting which is pulling value by deref is not gonna work.

All in all, this makes me to tend to avoid to use the user setting , but create the own user setting table to do bits and pieces.

2 Likes

Good stuff! Thanks Tsuji!

1 Like