Home › Forums › Cascading dropdowns › Query returns bad date – casc. dropdown
- This topic has 9 replies, 2 voices, and was last updated 3 years, 6 months ago by Alexander Bautz.
-
AuthorPosts
-
-
May 13, 2021 at 10:38 #33443
Hi Alex,
I’ve started working on cascading dropdown in the morning and everything was fine. But suddenly, cascading dropdown begun to offset date minus one day.
1. Attachment – source list with data about products and expiration date.
2. Form in the current list item to show the date for the product.See more in the attachment.
Thank you for your reply.
Steo- This topic was modified 3 years, 6 months ago by Steve.
Attachments:
-
May 13, 2021 at 11:15 #33448
I’ve also updated to the latest version and it’s still not working, but another error occured in Chrome console:
Uncaught TypeError: d.split is not a function at String.eval (eval at <anonymous> (SPJS-casc.js:10), <anonymous>:1:19840) at Function.each (jQuery.js?v=1620900533451:2) at Object.eval (eval at <anonymous> (SPJS-casc.js:10), <anonymous>:1:19714) at Function.each (jQuery.js?v=1620900533451:2) at Object.setFields (eval at <anonymous> (SPJS-casc.js:10), <anonymous>:1:19643) at Object.fill (eval at <anonymous> (SPJS-casc.js:10), <anonymous>:1:20638) at eval (eval at <anonymous> (SPJS-casc.js:10), <anonymous>:1:27434)
-
May 13, 2021 at 12:04 #33449
Hi,
A date field without the time part visible will always set the time to 00:00:00. SharePoint stores the dates as UTC in the DB and will automatically correct for the timezone / daylight saving time when saving the value. This means the value is off by in your case two hours – and this sets the date to the previous day.The normal list views in SharePoint corrects this back when rendering the value, but this plugin does not do that automatically.
You can try to fix this by using a calculated column in the list you are looking up in and set the formula like this:
=TEXT(Created,"yyyy/MM/dd")
Replace Created with your field name.
Now use this field in your cascading dropdown config and not the original date field.
Let me know how this works out.
The error you get when updating is most likely caused by one of the fields being empty – can you confirm this so I can look into this bug and fix it?
Alexander
-
May 13, 2021 at 12:39 #33451
Thank you, Alex, the workaround with the calculated field worked perfectly. For Czechia we must use this formula:
=HODNOTA.NA.TEXT([Created];"DD. MM. YYYY")
//For people from this country
Yes, one of the fields is being empty until the product is chosen. Then, “hodnocení do DFFS” is filed by the date. If this field is filled, the other rule took this value and set another field with this date (I earlier used custom JS). Now with the right formula, I can do better.
Thank you so much for a quick reaction.
Steo- This reply was modified 3 years, 6 months ago by Steve.
-
May 14, 2021 at 09:33 #33462
I’m glad you got it working – I’ll look into fixing the error occurring when the date field is empty.
Alexander
-
May 17, 2021 at 12:39 #33486
Hi,
I’m not able to recreate the “d.split is not a function” error – can you show me a few screenshots of your config so I can try to recreate it? – include the field type of any fields you use in the “Set field value [optional]” configuration.Alexander
-
May 17, 2021 at 13:04 #33493
Hi, of course:
1. Here are my fields of the list
2. Rule which triggers the error – but only sometimes – it triggers the rule which should hide exclamation mark with setTimeout.
3. Custom JS – custom code.When I use a file “casc.js” from February/07/2021 – version 4.4.5.16
The error does not appear in the developer console.
Thank you Alex,Steo
Attachments:
-
May 18, 2021 at 18:05 #33515
Thanks, could you also include a screenshot of your cascading dropdown config? – I don’t think the error could originate from the code you use to hide the exclamation mark.
Please note that the exclamation mark is there for a reason – you should clean the datasource as this might cause validation errors when editing this record in Internet Explorer.
Alexander
-
May 18, 2021 at 18:14 #33517
I’ve attached a screenshot of cascading dropdown configuration.
I know that the exclamation mark is there for a reason, but what should I do? How to clean the datasource?
I have a list that looks like this (2nd attachment). What should I clean? Can you give me an answer or redirect me to some thread?
Thank you, SteoUPDATE: I got it, I did not mention the extra white spaces. Thank you. I thought there must be a mistake that the exclamation mark warns me about extra white spaces that don’t exist. Now I found them :-))
- This reply was modified 3 years, 6 months ago by Steve.
Attachments:
-
May 18, 2021 at 20:45 #33522
Thanks. I’m still not able to reproduce this error. Did the error go away when you used the calculated field and not the actual date column?
I’m glad you figured out the “cleaning” of the data source.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.