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:

http://support.backendless.com/public/attachments/12a5775ec44a126b6250182f80da7c54.png</img>

But I keep getting the following error:

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

Hi Renato,

I am curious if something like this will work:
http://support.backendless.com/public/attachments/916823723a24c93bf8175efadbe6d52c.jpg</img>

Regards,
Mark

916823723a24c93bf8175efadbe6d52c.jpg

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

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

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

Hi Renato

for setting new “timestamp” you need to use this option “time”
http://support.backendless.com/public/attachments/76956b8e7861654a70850831f58dec7a.png</img>
and also I’ve created a new Block for transform “timestamp” to “Date”, you will get it in the next release
http://support.backendless.com/public/attachments/2be6f67bb6a9e00e1a770550cac8e899.png</img>

and then you can transform your date to Date String easily

http://support.backendless.com/public/attachments/40a6e96c6ea26d9258c89856794ac4fa.png</img>
Regards, Vlad

76956b8e7861654a70850831f58dec7a.png

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

Hi Renato,

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

Regards, Vlad

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

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

Hi Vlad,

It’s no problem at all, and I appreciate your help with this :slight_smile:

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

Hi Renato

please take a look at your “AnalyticsService” it must be restored

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

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 :slight_smile:
Renato

Thank you Renato!

have a nice day =)