Search code examples
google-app-maker

error in adding an updated timestamp with a button


I have a kiosk app running to check visitors in & out of specific offices. The checkedIn time is generated as an event tied to the model. In the events, I have an onCreate setup to record.checkedIn = new Date ();

The problem I have run into is on the Desk Clerks side of things. They have access to a table listing who is checked in. I want a button in each row that they can click to check out that individual. I setup the button under its onClick property to

record.checkedOut = new Date();

They both use the same datasource. However, whenever I click the button in preview the debug reports:

E
Tue Apr 04 10:14:24 GMT-700 2017
record is not defined
at signInAdmin.Panel1.Table1Panel.Table1.Table1Body.Table1Row.Button1.onClick:1:1

Solution

  • That's probably because 'record' is not defined in the context of onClick. You should be able to get the record by accessing the data source property of the widget.

    Try something like:

    widget.datasource.item.checkedOut = new Date();