Timestamp in Google Sheets works inconsistantly using MIT App Inventor

Hi - am busy with an App based on Metric Rat's CRUDQ 11 guide. Everything now works great except for one aspect. The Timestamp column in the spreadsheet based on the AppsScript below works perfectly and updates the relevant timestamp in column 4 if you physically edit the data in Column 3 in the spreadsheet but if you update the data in Column 3 using the app with first the ChStatus_BTN and then the Update Radio Button the item in Column 3 of the spreadsheet updates perfectly but the Timestamp doesn't change - all other formulas in the spreadsheet work as expected.

Sorry something went wrong with the images:
DB (2)

Where is the timestamp coming from when data is first entered?

Why are you using an onEdit function, instead of setting it from within the main script ?

Not sure if I understand your question but in the vacant spreadsheet after heading column 4 "Timestamp" whenever data is entered in Column 3 the corresponding row in Timestamp updates.

I will check how to code timestamp in column 4 in the app thanks - I didn't think of that as i already had the "Timestamp" feature in the spreadsheet.

I still don't understand why it won't update the timestamp when data is updated in column 3 by the app?

Show the part of your google apps script you are using to update the row.

Here you can set the new timestamp.

If it is this, from my CRUDQII script:

// Edit/Update existing record, requires index/row and current col1 to match
  else if ( fn == 'UPDATE' ) {
    var index = e.parameter.INDEX;  //index in list
    var col1 = e.parameter.COL1;  // current/existing value of col1 - it could be replaced...
    var data = e.parameter.DATA.split(','); //new data
    var range = sh.getRange((parseInt(index)+1),1,1,data.length);
    for (var i = 0; i < rg.length; i++ ) {
      if ( index != undefined && i == index && col1 == rg[i][0] ) {
    return ContentService.createTextOutput("Record updated");    

then apply the new timestamp in the data/list you send from the app.

Thanks for the great help.
I added a time and date picker to my app with the necessary code and it totally solved the problem.

You could always do it automatically / dynamically....


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