Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2013
    Posts
    226

    Unanswered: strange string bug?

    I was writing a script today and wanted to check if a variable was empty or not. So I used a text formula to see if the variable was empty ("").

    This appears to work fine, until that is the variable just contained a dash ( - ). Even though BD detected the dash was there (i.e. it was visible in a Show Message dialogue), as far as the check was concerned, it considered the variable to be empty.

    Was wondering if anyone else was able to replicate this?

    Cheers

    Matty

  2. #2
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hi Matty
    Yes can reproduce this result with a dash as well as full stop and comma (may be other symbols but not tested). Appears BD considers these as equal to blank but will correctly identify if compared to actual value, ie variable with dash compared to constant containing a dash will return true.
    Not sure if this is a problem but handy to know if a script does not operate as expected. Once aware likely we can work around it.
    Regards
    David

  3. #3
    Join Date
    Apr 2013
    Posts
    226
    Hmm .. well this came about as I was using a RegExp to specifically look for certain special characters such as dash, comma and full stop. I then need to check the result variable to see if any was found - if blank then nothing found. If BD decides that a string containing , . or - is blank then this is not at all helpful!

  4. #4
    Join Date
    Apr 2013
    Posts
    226
    Just to add, my RegExp is looking for anything that is not A-Z a-z or 0-9. So I can't possibily predict what the other characters might be to test for them specifically.

  5. #5
    Join Date
    Apr 2013
    Posts
    226
    I can think of potential workarounds, such as adding a normal character to the end of the return string, then trimming the first character from the string, then testing for the added character. I assume DB will consider a dash dot or comma as a character eligible to be trimmed!!?? I will need to test. But really these sort of workarounds shouldn't be necessary.

  6. #6
    Join Date
    Apr 2013
    Posts
    226
    I can confirm that my suggested workaround works. I have also reported this bug to BD, not that I am expecting a response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •