Testing an idea to get something automatic able to fire any event based on time, I could create something that I called âAutomatic Toggle Triggerâ (if you have a better name, go ahead⌠I can change it!).
The idea is simple and has 5 components (columns):
Time: Itâs the current time generated by Glide using Now() function. Due to Glideâs heartbeat is set to 10 sec, our triggers canât be faster than 10 sec unfortunately.
SECTIME: The seconds of the current day
Enable Trigger: The switch that enables/disables your toggle
Delta: Itâs the frecuency to change status (On â â Off). This should be a multiple of 10 due to Glideâs heartbeat is based on 10 sec
Status: The value/state of your toggle using a numeric format (0= Off / 1= On)
The main logic is carried out by the Status Column (Math) using Mod() and Trunc() functions, there is no rocket science behind it!
How does it work?
Just set a valid value (multiple of 10 sec) to Delta column and later, enable (ON) its âEnable Triggerâ associated .
After this, you will see how its Status toggles from 0<â>1 (False <â> True) every âDeltaâ sec
What is the use of it or what is the advantage??
You could use this for:
Firing a webhook periodically and get the weather conditions or the song name playing on internet radio (API calls)
Showing a message or alert on your APP based on a period of time
Avoiding using a Google script ruled by a timed trigger
Anyway, you can see a video to understand better the idea here:
I can see how this could be used to periodically refresh a code column, but I canât for the life of me see how this could be used to fire a webhook on a schedule. What am I missing?
You might have a JS code to have the weather between 2 cities, if Status is 1, shows data associated to Maracay (VE) else shows Houston (US) weather using an API call.
Of course, this code is not for Webhook actions per se, itâs just a simple example how to use this idea playing with API calls.
Hello everyone, does anyone here have any idea how to use this to be able to update the data in a column automatically? I have a column with the product availability âInventoryâ and the next column with the weekly availability âDefault inventoryâ. I am trying to automatically change the data in âInventoryâ every Monday by copying those present from the âDefault inventoryâ column.
Thanks
While I find out a right answer for your request I need to know something before:
Do you want to update your inventory automatically not matter your APP is running?
Unfortunately, this trick works only when APP is running on any device, there is no way to trigger it on Glide side (server) in background automatically so far.
Both the solution are ok, if itâs necessary i can go on app in specific time to start one action whit the button but i need to set the action to do the copy action from column âDefault inventoryâ in âInventoryâ automatically when i Press the button.
What do you mean whit âAPP Is running in any deviceâ? Can be the action started automatically when any user logs in? (not the admin)
I donât need to have the updated inventory at the exact moment. The important things Is that It is updated when the First user enters.
Ok, I think you can make it simpler, You might use Math function Weekday() and parse if the current week day is Monday to activate your button. In your case, your magic number is 2 (Monday)
Later, you can play with visibility conditions to show/hide your new Update Inventory button at any time every Monday when you load your APP and press your update action.
The question is not how to check the correct day but how can i update the inventory from column B to column A.
I have Column B whit different quantity per product.
I need to copy and paste all this quantity from column B to column A when i press the action button.
When viewing the details of an item, all you need is a button with a Set Column action that will take the default column value and overwrite the inventory column value. I think @gvalero was trying to provide some logic to help control when that button is visible.
Is this in a Google Sheet or a Glide Table? If itâs a google sheet, Iâd probably just set up a timed trigger that will iterate through each row in the table and reset once a week. If this is a glide table, then you may have to utilize the glide api and something like Integromat/Make or Zapier to iterate through a list of RowIDâs and update the inventory column
I canât think of an easy wayâŚor any wayâŚto perform a set column action on multiple rows from a single action strickly within glide. I think an action would have to occur whenever the first user views a specific item. Then store a date and time when that reset occurred, so you knew when to reset it the next week when a user views an item for the first time.
Unfortunately it is on glide tables. Following your logic one thing came to my mind, If I create an action that every week I manually click as administrator and it clears an entire âswitchâ column and then I insert a new action with condition in my flow that IF the first user of the new cycle find the empty Switch column copy the value from âDefault Inventoryâ to âInventoryâ? I think it might work but the question is how do I clean the values ââof a column in all the rows of the sheet? Do we have the same previous problem or is it feasible?
Now I am understating your use case, there was something not clear in the beginning but no problem.
I know the problem you are facing (I have had it since months ago), you want to update your inventory using several rows at the same time but the Set Column action only works with a simple relation or with the current row (This item).
If a Set Column action could work with a multiple relation weâd have the solution very fast/simple but it isnât possible so far. Your case is similar to the shopping cart system when a user has ended an order, we need to clear that shopping cart and start process over but Glide doesnât allow a multiple relation in a Set Column or Increment Number action and we have to implement other workarounds⌠a tragedy to me!
Your plan B (what I use so far) is to use a GS script to get it but working with Glide Tables (GT) the case gets worse.
Yes, itâs for shopping cart.
I found a solution, for my specific case itâs ok because i only have 32 items.
Only one compromise requested, you have to create a inline list and click on the products one by one. You can use the function set column values in âSwitchâ columns. I set 1 on this click. Click on all items one time to set 1 for all products.
Now the system Is activated, all time that the first user of the day click on one product active one function that verify if âSwitchâ column Is 1 and if YES it copy âDefault Inventoryâ value in âInventoryâ and set 0 in âSwitchâ.
I set the Switch column because i use the it to Hide/Display products that are restored. When inline list is empty the flow is ready.
One time a week you only have to click on all products one at a time to restore the flow.
Whit small inventory i think this is a good solution.
Sorry for bad explanation, i tried to do the best.
If you want i can share the demo to understand better the flow.
It is a more complete version of a shopping âtemplateâ provided for free by Jeff a few weeks ago.