Using USERSETTINGS to filter a Slice

You find a man defeated. 

I am trying to define a Slice of my TRACK_ACTIVITIES table, using a value from USERSETTINGS(Track).

Nothing I do returns a slice with any content.  What (horribly obvious thing) have I overlooked?

The only thing I can think of - but don't know how to check - is that USERSETTINGS(Track) is a dependent lookup in the User Settings form (see image).  I think/hope the Track value returned in the UI Form, based on preceding choices of Group and Section, is saved into USERSETTINGS and not just recalculated in the UI?

Pointers and suggestions gratefully received.

gcor71_0-1690216622884.png

gcor71_1-1690216778373.png

gcor71_2-1690216844202.png

 

 

 

Solved Solved
0 12 371
1 ACCEPTED SOLUTION

You could change your slice expression to:

OR( ISBLANK([_THISUSER].[track]) , [track]=[_THISUSER].[track] )

View solution in original post

12 REPLIES 12

Try USERSETTINGS("Track") (with quotes), or [_THISUSER].[Track]

And how do you know it's not returning any content? Are you sure you're looking at the right view?

 

So - my instinct was right, it was a problem with the USERSETTING form!  I was missing that the user has to take the action to select the Track - I was leaving it unselected, so it wasn't saving!

Any suggestions how to get round this, to force the Track to be saved without requiring a user action?

Thanks for your reply, regardless.  It forced me to think again about what was happening - and why.  Leading to the error.

gcor71_0-1690219198378.png

 

Just add a default with an Initial Value in your User Settings

Hey. I don't follow your suggestion.
The dependant drop-downs, present the single correct Track (N in this case) - but the user must click it so it's selected and saved.  I can enforce this by making the field required - but that isn't very smooth for the user.
I do not know where to start to define the default - can I use the GROUPS[Track] statement as I did with the dependant drop-downs?  I tried, but it didn't seem to work.

Interested to understand your solution.

You obviously provide a list of possible values to them to select from their User Settings, right?
With the Initial Value property, you should add an expression that gets a default value.

This depends on your specific schema and use case, so I cannot give you a general solution, but rather an example.

Let's say that I have the option to select which company I'm working with in the user settings, but that list changes based on the ones I'm allowed to select.
You could use something like an INDEX([YourListExpression], 1) or ANY([YourListExpression]) so that there is always a value selected inside User Settings.
If, on the other hand, you know that there is always going to be a certain value like "Official", or "Undo", "Pending", etc... You could put that value in Initial Value so that every user starts with it and then can change it at will

Thanks - I follow you.

However, in this case I want to set the 'Track' value for the user, to the correct value based on their selection of 'Group' and 'Section'.

If I understand well, the approach you suggest would assign "something" to 'Track', but not necessarily the correct value.

What expression would I need to set the 'Track'  based on 'Group' and 'Section' selction, without the user having to actually select the single 'Track' result they are currently being shown.  All three values are in a single GROUPS table.

See the form below.  User has selected a group and a section, the dependent drop-down has automatically picked up 'N'.  However, the user must click the 'N' to select it.  This is the step I want to avoid.

gcor71_0-1690320565457.png

 

 

Take the valid_if expression that you're using for the [track] column, and enter this into Initial Value:

IFS(
  COUNT( {valid_if expression} ) = 1 ,
  ANY( {valid_if expression} )
)

Thank Marc.  I'd already tried that, and that only succeeds in forcing "This entry is required" and not selecting the [Track].

In User Settings, I am defining 3 fields as follows:

Group : valid if GROUPS[Group]
Section : valid if GROUPS[Section]
Track : Valid if GROUPS[Track]

As you no doubt know, Appsheet recognises the intent and treats these as dependent drop-downs on the form.  The result [Track] is always a single value.

Adding the GROUPS[Track] as an initial value isn't selecting (or forcing) the Track to avoid the user having to Click the option.

Any other suggestions most welcome.

FYI in this screenshot, user has just selected Section = Beavers. The App shows Track and the (only) available value "N".  To save the form, the user will need to click on the "N" option.

gcor71_0-1690355621948.png

 

Oh, you're using implicit dependent dropdowns. That would make sense why it didn't work. You would have to write the appropriate SELECT() expression as if you were setting up manual dependent dropdowns, then use that as the "{valid_if expression}" in my previous suggestion.

It's encouraging that it's not me then, but how it works.

Thanks Marc - appreciate your taking the time for me.

You could change your slice expression to:

OR( ISBLANK([_THISUSER].[track]) , [track]=[_THISUSER].[track] )

Elegant error handling. Thank you.

Top Labels in this Space