Variable update using text input

I currently have a search window (Text Input) which takes the text user has entered. And I have a button which is used as a trigger for this to work together which has an “Action” which is required and the respective object table then updates based on set of this variable(I pass the searched text to a variable which updates on click of a button).

User types in search box → variable NOT updated yet
User clicks button → action runs with OLD variable value ← :cross_mark:
User clicks away first → variable updates
User clicks button → action runs with CORRECT value :white_check_mark:

But this set up is currently causing an issue which results in the user needing to click the button twice for the flow to exactly complete, which is causing the app to behave in a which was not expected.

Is there a walkaround to this?

The requirement is “User should click the button inorder to apply the searched text as a filter on the object table”

Hey @Benutzer7!

What is you action used for? It seems that you want to filter your table and execute an action at the same time? Or maybe you just use this action to filter the table?

By default, a Text Input widget is automatically updated when user write inside. If you want to wait the user to press the button to update the table, here is the way I would recommend:

  • Configure the button to trigger an event on click that will copy the input variable into another variable
  • Set the copied variable as a filter in the object set you are using in the table

This way, the filter isn’t updated until the user press the button.

But if your goal is only to filter your table, I would recommend you to use the Filter list widget with a keyword filter. It’s the best way to do it.

I hope you find this helpful. Feel free to ask if you have any question.

Nathan :slight_smile:

Hi @Donat, thanks for the help. I was able to solve it using the following ways -

Issue - 1 : Text input and button onclick filter

Yes - The Setup
An action is used to handle a parallel activity, and the same button event also updates the filter variable which is used as a parameter to the object backing the object table. This was intentional — the setup ensures the user always has to click the button to see any changes. A “set variable” functionality is also used on that same button click.

The Blocker
When a text input was introduced — where the user enters new or updated text, wired to the button to filter the object table with that specific text — an issue appeared in view mode: the user has to click outside the text input first before the button click works. In edit mode it behaves as expected, but in view mode it breaks.

The Root Cause
The search text was being used directly as a parameter to filter the object table. This created an automatic update loop — the table would re-filter as the value changed, rather than waiting for the button click.

The Fix
To break this loop, the “Recompute variable value” was set to “only when triggered by an event” on a new dedicated variable. The search text now feeds into this new variable instead of directly into the table filter. Since this variable only recomputes on the button click event, the table is no longer automatically updated as the user types — and the button works in one click, even in view mode.

Solution - I reverted the Recompute variable value to on load and on trigger of an event and passed the duplicate variable which I updated on every set.

Therefore, decoupled the text input from the filter by routing through a controlled, event-triggered variable. The user — not the typing — drives the update.

Issue - 2 : I also encountred another “race condition” between variable set and action trigger.

Same setup as previous but here to the action I was passing a parameter.

The Setup
Multiple buttons each set a specific standalone variable (1 button → 1 string variable), with one shared/general variable tracking the current selection. On button click, the shared variable was updated and an action was triggered using it as a parameter — all in the same event.

The Blocker
The action always received the previous state of the shared variable — the “-1th” value — because setting a variable and triggering an action in the same event happen concurrently. The action fires before the variable has committed its new value.

The Fix
Remove the shared variable from the action chain entirely. Each button now passes its own value directly to the action as a parameter at the point of click — no shared variable needed as a middleman.

Im interested in understanding additional solutions for the same.

Learnings

Workshop events are concurrent, not sequential. When you set a variable and use it in the same moment, the order is not guaranteed. The solution in both cases is to break the dependency — either by controlling when a variable recomputes, or by removing the variable from the chain and passing values directly at the point of interaction.

Hi @Benutzer7, very interesting that you are also facing the same issue Workshop function occasionally receives previous value of a Workshop Variable - Ask the Community - Palantir Developer Community, but I didn’t understand whether you were able to resolve it or the solutions that you wrote are yet to be implemented and tested, but if any those works, please update, would be of great help

Thanks,
Sumith

Hi @Sumith, I actually was able to solve it. But for issue - 2, it is just a hardcoded one. As mentioned, it would be reat if there were other approaches for second issue.

For issue - 1 : it it working as expected

How do you setup a button that can both trigger an event and an action? I though that wasn’t possible. Would be happy to know more about it, can you give a screenshot of the button configuration?

Great to hear that, could you share the fix that when the variable has the updated value but when I open an overlay or pass the variable to a function, it passes the previous value

The way I perceive this issue is that when we change values within text selector or filters or any other widget component and expect that the variable which holds this change is done in an instance, but under the hood while the variable changes it value, it also retains the previous value, but workshop reloads multiple times until the variable is resolved so we see the right value on object filters but when they are passed to functions, since workshop doesn’t resolve variables until they are used (Lazy-Loading), they result in race-condition and I have been struggling with this issue

But the thing I am actually curious is it due to overlay, because I have derived columns which also take in the text selector variable, but I have not noticed race conditions

Also, I still don’t understand is it due to my function computation, does it matter if I keep it automatically or recompute and on module load

Hello @Donat, This can be done if you have a button group and you select on-click to perform an action and if you scroll to the end, you will see options as on start of action submission and on successful completion of action submission, and there you can configure events to recalculate, reset variables or set variable value from source to target etc.,

Oh okkk! I now understand the problem “Issue 2”.

When you use the “on start of action submission” setting in a button configuration, event occurs when the action submission begins. So it always take the old value of the variable you are updating using the chained event. See the documentation.

@Benutzer7, a workaround that could work for you is:

  • Keep your Text Input widget the same
  • Use the text input output variable in your action
  • In you button configuration, enable the “on start of action submission” to copy the Text Input variable into another variable
  • Use the copied variable to filter your object set in your Object Table widget

This way, the action will use the auto-updated variable from your text input widget, and when you press the button, it will copy the new filter variable to update your object set.

Let me know if it solves your problem.