Query returns bad date – casc. dropdown

Forums Cascading dropdowns Query returns bad date – casc. dropdown

Viewing 4 reply threads
  • Author
    Posts
    • #33443
      Steve
      Participant

      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 2 years, 10 months ago by Steve.
    • #33448
      Steve
      Participant

      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)
    • #33449
      Alexander Bautz
      Keymaster

      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

    • #33451
      Steve
      Participant

      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 2 years, 10 months ago by Steve.
      • #33462
        Alexander Bautz
        Keymaster

        I’m glad you got it working – I’ll look into fixing the error occurring when the date field is empty.

        Alexander

      • #33486
        Alexander Bautz
        Keymaster

        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

      • #33493
        Steve
        Participant

        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

      • #33515
        Alexander Bautz
        Keymaster

        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

    • #33517
      Steve
      Participant

      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, Steo

      UPDATE: 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 2 years, 10 months ago by Steve.
      • #33522
        Alexander Bautz
        Keymaster

        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

Viewing 4 reply threads
  • You must be logged in to reply to this topic.