graham street
Posts: 0
Joined: Thu Jul 03, 2014 11:08 am

recording date and time on button click

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.

graham street
Posts: 0
Joined: Thu Jul 03, 2014 11:08 am

recording date and time on button click

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
Image
Image

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

recording date and time on button click

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...

graham street
Posts: 0
Joined: Thu Jul 03, 2014 11:08 am

recording date and time on button click

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

graham street
Posts: 0
Joined: Thu Jul 03, 2014 11:08 am

recording date and time on button click

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?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

recording date and time on button click

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.

graham street
Posts: 0
Joined: Thu Jul 03, 2014 11:08 am

recording date and time on button click

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

recording date and time on button click

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.

graham street
Posts: 0
Joined: Thu Jul 03, 2014 11:08 am

recording date and time on button click

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

recording date and time on button click

Hi Graham,

Please give us your app public link and describe steps to reproduce your problem.

Regards.

Return to “Issues”