Page 2 of 3
recording date and time on button click
Posted: Fri Jul 11, 2014 10:21 am
by graham street
Hi Maryna,
I have shared the app with you, if you look at the reply I gave 2 days ago showing the screen shots of the app and the mapping, the link plus the password are in there.
However it will no longer work as I have ( in desperation ) deleted the app and the database and started again from scratch.
I will let you know how if I run into the same problem with the new version.
recording date and time on button click
Posted: Fri Jul 11, 2014 12:33 pm
by graham street
Hi Maryna,
Ok I have deleted the database and rebuilt it, I have also completely rewritten the app. I am still getting the same error so I must have done something wrong somewhere.
I have made the app public so you can have a look to see if you can find the mistake.
http://appery.io/app/mobile-frame?src...
the user name is graham
the password is 123
I have attached the network error and the network response error as requested before
Please note that I have only mapped the "travel to" button at the moment on the assumption that if I could get that working then I would just replicate it onto the other buttons choosing the correct database field
I would be grateful if you could have a look at this and try to find where I have made the mistake.
Regards
Graham
recording date and time on button click
Posted: Fri Jul 11, 2014 3:01 pm
by Evgene Karachevtsev
Hello Graham,
You have not correct mapping to service travel_to_service
You make the mapping from address_id to X-Appery-Database-Id.
This is not correct. in X-Appery-Database-Id must be the ID database
In your case this is 53aac0f2e4b02c5eb81409ff
You may find more information here: http://devcenter.appery.io/documentat...
recording date and time on button click
Posted: Mon Jul 14, 2014 6:12 am
by graham street
Hi Evgene,
Ok I have read that information and can see what I have done wrong so I have now removed that mapping. I tried the app again and got this error in the network response.
{"code":"DBSC252","description":"Invalid value for type 'date': '1405324835741'."}
so I have changed the the travel_to column's type to number, and everything works fine.
if I look at the network response it says
{"id":"53c38fb8e4b09f5c7d5131f2","createdAt":"2014-07-14 08:07:20.059"}
So that is great because the app works and the logic works however there is a problem with the database in that it does not record the data and time in the correct format.
Can you look at this and see if you can work out why this is the case.
Thank you very much
Graham
recording date and time on button click
Posted: Mon Jul 14, 2014 9:37 am
by graham street
I now have a situation where when I click on "travel to" "arrive at" and "complete" the service creates a new row for each service. this is not what I want at all the service should ONLY update the address that I am working on at the time.
Logic tells me that I need an update service and not a create service and that I need to carry forward the _id from the database so that the correct address is updated.
Am I correct in this assumption?
recording date and time on button click
Posted: Tue Jul 15, 2014 12:34 am
by Yurii Orishchuk
Hi Graham,
Yes, you have described right way to make update service.
Please take a look on this tutorial to understand how to work with "update" service: http://devcenter.appery.io/tutorials/...
Regards.
recording date and time on button click
Posted: Tue Jul 15, 2014 6:06 am
by graham street
I tried the app again and got this error in the network response.
{"code":"DBSC252","description":"Invalid value for type 'date': '1405324835741'."}
so I have changed the the travel_to column's type to number, and everything works fine.
if I look at the network response it says
{"id":"53c38fb8e4b09f5c7d5131f2","createdAt":"2014-07-14 08:07:20.059"}
So that is great because the app works and the logic works however there is a problem with the database in that it does not record the data and time in the correct format if you set the field to "date"
Can you look at this and see if you can work out why this is the case.
Thank you very much
Graham
recording date and time on button click
Posted: Tue Jul 15, 2014 9:56 pm
by Yurii Orishchuk
Hi Graham,
Please follow this solution:
1 Navigate to "Request" tab.
2 Find "Date" parameter in request tab and click "Add JS". http://prntscr.com/3aqhpn/direct
3 JS editor appears. Fill it with following code: http://prntscr.com/3aqic0/direct
pre
return new Date(value).toISOString().replace(/T.*/gi, "");
/pre
Regards.
recording date and time on button click
Posted: Wed Jul 16, 2014 10:06 am
by graham street
sorry that does not work, in fact it crashes the entire App
if I put that code into the js for a number filed the app will not start
if I put it into a date field the app will not start
if I put
return (new Date()).getTime();
into a number field it records the epoch time
if I put
return (new Date()).getTime();
into a date field I get an invalid date error in the network response
recording date and time on button click
Posted: Thu Jul 17, 2014 12:29 am
by Yurii Orishchuk
Hi Graham,
Please give us your app public link and describe steps to reproduce your problem.
Regards.