Set a timer for a TAB

Hi,

Since there is no way to tracking if a button is pressed in glide and opening a link at the same time ( for now) I wanted to have a install app tab, where there is a welcome message and a download button to my apk file, however there is no way for me to capture the click and then move to the next screen, whist hiding the install tab. My alternative to this is having a 30 sec timer that gets triggered on user opening the app ( splash screen-like)

Up, someone please help with this @ThinhDinh any suggestion?

So you want the download button to trigger a tab visibility condition?

the download button has a apk file linked to it, on clicking it user downloads my glide app as a apk.

But after that i want the tab to disappear.

You can set a true/false condition with a timer based off the users registration time.
The button can disappear after x minutes.

1 Like

So if the user has downloaded the app, the tab disappears and vice versa?

yes, either by having a timer set or some way of knowing user clicked the button

Gotta wait for the compound action then. Increment a column + open link action.

yea i guess so, waiting for it to come out of staging

How can i get the timestamp from user login? the App: Logins does not shop up in glide. How to capture the time?

You can create a column in your user profiles sheet and use an arrayformula to bring it over.

just to be on the safe side, is there a formula i can use that will lookup the App:Logins time and email and match it with email on my users sheet, rather than just using arrayformula?

I’ve found that a query function is ideal for this:

=QUERY({'App: Logins'!A1:A}, "SELECT * WHERE Col1 <> ''",FALSE)

1 Like

Thnx for this, but may i ask, how is this diffrent from arrayformula?

Sorry, it’s not really. I was actually replying to @ThinhDinh.
To do what you want, I think I would probably write a custom trigger function.
If you show me what your sheet structure looks like, I could knock up an example for you.

Okay, so you’d like to make a copy of each row in your App:Logins sheet, but only if the email address exists in your Users sheet. Is that correct?

1 Like

Something like this would do it:

function on_sheet_change(event) {
  var sheetname = event.source.getActiveSheet().getName();
  if (sheetname == 'App:Logins') {
    var sheet = event.source.getActiveSheet();
    var new_login = sheet.getRange(sheet.getLastRow(),1,1,2).getValues();
    check_add_user_login(new_login);
  }
}

function check_add_user_login(new_login) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var user_sheet = ss.getSheetByName('Users');
  var valid_emails = user_sheet.getRange(2,1,user_sheet.getLastRow()-1).getValues();
  var logged_in_user = new_login[0][1];
  valid_emails.forEach(function (email) {
    if (email == logged_in_user) {
      var sheet = ss.getSheetByName('User Logins');
      sheet.getRange(sheet.getLastRow()+1,1,1,2).setValues(new_login);
      return;
    }
  });
}

You could add that as a trigger function to run whenever there is an ON_CHANGE event, ie:

The logic is that whenever a row is added to your App:Logins sheet, it will check the email address to see if it matches any of those in your Users sheet. If it does, it will write a new row to the User Logins sheet. If you need it written elsewhere, then just adjust accordingly.

An array formula with a VLOOKUP should do it if you want to match the user profile email to the app: logins email. The question is, do you need the first initial timestamp, or the timestamp of the last time they signed in?

Also be aware that I think glide stores the timestamps in the app logins sheet as a string, so you may need to pick it apart into a date.

Also if row count isn’t a concern, you could duplicate the sheet with a new name, so it’s visible writing the glide data editor.

2 Likes