vLookup – SyntaxError: Invalid Character

Forums vLooup for SharePoint vLookup – SyntaxError: Invalid Character

Viewing 5 reply threads
  • Author
    • #23950

      Hi Alexander

      I’m wondering if you could help with an issue I’ve come across.

      I’m using vLookup to create a quick way of finding a duplicate entry in a list of unique values, so if someone tries to save an item that would prompt the sharepoint error “This value already exists in the list.”, vLookup will present that item, and let the user edit it directly.

      The issue I’ve encountered is that my unique field includes accountName (as text), in the form domain\username. It appears that the backslash character is invalid when it comes to vLookup. See the attached screenshot.
      I’ve tried a lot of other characters, and the only other that I’ve found which causes a similar problem is a double quote (SyntaxError: Expected ‘}’).

      Is there anything that can be done to make this work, other than deleting or substituting characters in the string?



      SharePoint 2016 on-premise
      DFFS frontend:
      DFFS frontend CSS: 4.46 / 4.46
      Autocomplete: 1.6.28
      Cascading dropdowns: 3.7.25
      jQuery: 1.12.4
      Lookup: 1.1.15
      Resource management: not loaded
      SPJS-Utility: 1.330
      vLookup: 2.2.127

    • #23959
      Alexander Bautz

      I’m not able to recreate this issue. Can you tell me what the first character in your domain name is – the one after the \ – it might be an issue with JavaScript using the \ to escape certain characters.


    • #23971

      Thanks for the fast reply.
      I’ve been doing some more testing of this, it looks like is it javascript/json escape characters causing the issue, but not quite as I was expecting.

      A backslash on it’s own causes the error – it’s expecting a valid escape code because the backslash is there. Backslash followed by a non escape code character generates the error message and kills the vLookup.

      A backslash as a valid escape code ( \n \r \\ etc) doesn’t error, and the whole string is then successfully used in the vlookup query.
      For example; domain\rtester works as \r is a valid escape code.

      I’ve attached some more screenshots to help illustrate. Firefox gives a slightly different error message to IE, specifically calling out a “bad escaped character”

      Any ideas?


    • #23984
      Alexander Bautz

      You are right – I tested it with valid escape characters and did not get the error.

      Unfortunately it is not so easy to fix it because I use JSON.parse to convert the JSON string for the vLookup config into a proper object and it is difficult to replace the \ in the text.

      Are you able to replace this character in your code – before you write it to the field?


    • #23996

      Thanks Alexander

      What I’ve done as a workaround is left the field that needs to be unique as it is (essentially the accountName taken from a people picker and a value from a choice field joined together), so SharePoint takes care of enforcing unique values.
      For the vLookup I’ve swapped from using the unique field on it’s own as the filter to using the people picker AND the choice field as filters. The end result is the same.
      It’s actually quite a neat solution that stops users getting to the point of saving and finding that they can’t do so.
      Excellent functionality made possible by DFFS.

    • #24006
      Alexander Bautz

      I’m glad you were able to work around this limitation.


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