NAV 5 blank is not equal to NAV 6 blank???

beno.pulverbeno.pulver Member Posts: 31
Hi friends,

I detected following code in our vertical solution (look at the ' '):

CAG := "Customer Status" + "Address Class";
CASE CAG OF
'KA': ...
'KA': ...

' ': ... <<<===

ELSE ...
END;

This works perfectly with a NAV 5 Client (native database).

But if you upgrade the NAV 5 database to NAV 6 and do the same thing with a NAV 6 Client, then the result differs.
The ' ' (two blanks between the appostrophs) must be changed to '' (no blanks between the appostrophs):

CAG := "Customer Status" + "Address Class";
CASE CAG OF
'KA': ...
'KA': ...

'': ... <<<===

ELSE ...
END;

Otherwise a blank value will not be identified by the case and will go to the ELSE Statement.

Do you know the reason for that? Is NAV 6 checking a blank as SQL NULL value and a ' ' as an empty value???
For me it is strange, especially because it is a native database!

Thank you for your Information, Beno

Answers

  • kinekine Member Posts: 12,562
    are all variables of type code or some are code and some text?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ara3nara3n Member Posts: 9,256
    the case statement in nav 6 is CASE sensitive, in nav 5 it was not case sensitive
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • beno.pulverbeno.pulver Member Posts: 31
    @Kamil: All of the variables are of the type "Code".

    @Rashed: Okay, so either I Change the program code to "" (no space between the two ") or I use "IF" instead "CASE"?

    Thank you very much, Beno
  • ara3nara3n Member Posts: 9,256
    change the case statement to uppercase
    CASE UPPERCASE(CAG) OF
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • beno.pulverbeno.pulver Member Posts: 31
    Hi again Rashed,

    thank you for the advice. But... UPPERCASE would only help, if it would be a textfield.
    I would be astonished, if that would help in my case with blanks!?!

    In my case it is a code field and contains values like 'AA', 'BB', 'CC' and as well blank.

    The Problem is/was, that an empty field was compared with two blanks.
    So instead of comparing it with "" it was compared with " " (two spaces in between).

    NAV 2009 seems to make a difference between a compare with "" or a compayre with " ".
    NAV 5.0 doesn't make a difference.

    Best regards, Beno
  • ara3nara3n Member Posts: 9,256
    ok change the case to the following

    CASE DELCHR(UPPERCASE(CAG),'<>',' ') OF
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.