Backendless Support
 
Answered

v4 Codeless: Date block question

Hi all,

Just a question around how the date block works:

I have a date coming from a backendless table ("ad" object retrieved via data api block, as you can see below), and would like to format it as a date string with one of your provided blocks:

12a5775ec44a126b6250182f80da7c54

But I keep getting the following error:

  1. 400 - ad.Campaign_Start.toDateString is not a function

Is this block not able to parse dates that backendless seems to report as a string?

Renato

Leave a Comment

Comments (14)

photo
1

Hi Renato,

I am curious if something like this will work:

916823723a24c93bf8175efadbe6d52c

Regards,

Mark

photo
1

Hi Mark - Thanks for the suggestion. I went to go and test this theory out, but when I went to drag a block into the editor window, it somehow deleted most of the blocks/ code in the function.

I can see the deployed version's code is intact (via the code tab), but the tab in the designer has it scrubbed. Is there any way to get the "working copy" of the function restored to that code that is deployed? (So I don't have to waste time re-creating all the blocks?)

Renato

photo
1

Hi Renato,

You can delete the local storage in the browser to void all the unsaved changed and revert back to the deployed version.

Please let us know if the problem with disappearing blocks occurs again.

Regards,

Mark

photo
1

Thanks Mark, got the code to deploy.

As far as the syntax goes, it is now correct and will not throw an error. But, the results are not correct ... the custom conversion function + backendless string convert returns a date of "Sat Apr 25 2065", when it is "1501567200000" (via rest) or "Aug 1, 2017" in backendless console, in this example.

Renato

photo
1

Hi Renato

for setting new "timestamp" you need to use this option "time"

76956b8e7861654a70850831f58dec7a

and also I've created a new Block for transform "timestamp" to "Date", you will get it in the next release

2be6f67bb6a9e00e1a770550cac8e899

and then you can transform your date to Date String easily

40a6e96c6ea26d9258c89856794ac4fa

Regards, Vlad

photo
1

Thanks Vlad, switching to time was what I needed! :)

photo
1

Hi Renato,

We just released new features, so take a look at new block "date from timestamp"

Regards, Vlad

photo
1

Hi Vlad,

I see the new block now, thank you.

I do however see some more inconsistencies with codeless when there are new releases.

When I opened my codeless service to check out the new block, I noticed some of my string values (the simple green block where you specify a string) were all missing.

I cleared cache, and then they came back to the version that was deployed.

I then made the change to use the new block, and deployed. When I went back into the service to make some more changes, I noticed most of the blocks were then missing after the deploy.

Is there a way to get the version of the code from like a day ago, so I don't have to reassemble the entire function? (I remember Mark also saying at one point in the past to check out the code tab in BL to see if the logic is indeed gone ... I did check this time, and it seems to be gone from there as well).

Can you advise?

Thanks,

Renato

photo
1

Hi Renato

It was not supposed to happen because of new features.

We just added a new blocks and did not remove any other blocks.

Anyway, accept our apologies for the inconveniences. We'll try to reproduce the problem to avoid it in the future.

And yes, we have backup files for you, how would you like to get it?

I can make an archive and deploy it to your app in Files Service, lets say to the root directory.

I've noticed that you have only 2 changed files, so you have to replace exists file contents (xml files) with content from backup. then go to Codeless tab, open the logic and do some manipulation (just shift root block) for trigger code generation, new js code must be regenerated according to xml file and then deploy the new logic.

or if you want I can try to do it for you

and just remind:

when you do some changes in one method of service, lets say MyServiceA, and then do some changes in another method of the same service MyServiceA and when you click to "Deploy" button you actually deploy all changes for service MyServiceA

Regards, Vlad

photo
1

Hi Vlad,

It's no problem at all, and I appreciate your help with this :)

Would you mind restoring the service? Right now, it would just be the "AnalyticsService" / Model that I'm concerned with.

I'm also not sure if this extra context would help with your investigation, but a few weeks ago (in my "RegistrationService"), simply just opening the function would mark it as a "change" - went from no change (from deploy) to being green in the sidebar (changed), simply on opening it in the designer window (with no manipulation to any of the blocks). Also any of the weird "disappearing" issues i've had is almost always surrounding the string blocks (or other blocks using string blocks).

Renato

photo
1

Hi Renato

please take a look at your "AnalyticsService" it must be restored

photo
1

when/if you noticed that some of your blocks are disappeared, don't deploy the changes, just create a new support topic and we'll help you, and also it will really help us to catch/fix the problem

photo
1

Thanks Vlad!!!

I was able to do the final testing with the new block now, and everything works great!

I will definitely continue to keep an eye out for any oddities with disappearing blocks (and try to pay more attention with steps to reproduce) and will report them if anythign else comes up!

Thanks for your awesome support :)

Renato

photo
1

Thank you Renato!

have a nice day =)

photo