CodeColumn - How to control the execution

I develop a community app that at some point needs to send json data and returns another json (the algorithm for tennis match scheduling).

The right way would be to use POST request but I am not in the situation to pay for call API which comes in the expensive tier.

I developed a code column hosted on github that does the work. But user experience is bad. Typically when app user provides some input in my app, I have a button to start executing the algorithm that typically lasts few minutes. During that time, I want to show some waiting cursor. My condition for waiting cursor is codecolumn to be empty (until I receive algorithm result). But this doesn’t work as the previous codecolumn execution value is still there and waiting cursor never gets displayed.

After a minute or two, Glide updates codecolumn with new values (which is OK), but app user is confused as there are no waiting indication.

The same happens with javascript post fetch column (additionally I have CORS issue there).

Any suggestions how to pack this so user have a nice experience (waiting the algorithm to complete the work)?

I am on the maker plan.


When you click on your button, first have it write the current code column value to another column, then execute your script. As long as both columns match, you could show your users something indicating that your code is processing. Once it returns something, then both columns will no longer match, meaning the code has completed.

1 Like

I did exactly that, now reading your suggestion and it works in 99% of the cases. Thanks for suggestion.

I noticed when users doing input in the screen so the resulting json that I am sending is different works for some input and for other doesn’t work. For some input Glide doesn’t trigger code column to evaluate a new value.

If the component that affects json is on the same screen where the underlying table is - then it does trigger, otherwise if in another table it doesn’t :frowning:

I solved the problem by adding current timestamp in the input json

1 Like

is there any way I instruct glide to do not evaluate code column for all rows? I want to execute it only for my last row in the table…

If you can have an if-then-else column to return the input to your code to only be available when it’s the last row, then I think it would be fine.

In your code, handle the empty input scenario.

1 Like

I added the waiting cursor (gif) tho indicate the progress while my new code column != old code column value.

For some reason it shows up only sometimes - although the computation is in process. I believe the reason is the other thread (that does code column computation) never allows UI thread to refresh the screen.

Any trick/hint how to solve this?

You could try adding two steps to your action, show new screen (with the gif) and goto tab (to end it)

Modify your action sequence so the first action is show new screen (overlay) and put your gif on the screen. Then make the last action goto tab (to end)

Wouldn’t you only show the gif if the values match? The value in a code column does not change until something is returned from that code.

1 Like

before my algorithm starts oldCodeColumn != newCodeColumn
when I click on StartAlgorithm, I assign oldCodeColumn = newCodeColumn
Call the algorithm, ShowWaitingCursorGif while oldCodeColumn == newCodeColumn
When newCodeColumn is evaluated, the process is done and giff is not displayed anymore.

Sorry if I understood it badly

1 Like

That sounds correct. So did you make a change and it’s working now, or do you still have a problem?

1 Like

All works good. Thanks @Jeff_Hager

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.