Strange Behaviour using :: operator

Try this: 1. Create a simple table with a Field of DataType Code. Call it for example Code (fantasy!) 2. Write the following line of code everywhere you want: Code := Code::a; 3. Exit saving the table and then reopen it. You will find the following code: Code = Code::“16895”; Very funny! Does anyone know what does it mean? What’s the meaning of :: operator if you use it with fields of DataType Code? Thanks, Marco

It also works with text fields. Text := Text::a After saving that you will find Text := Text::“97” 97 is the ASCII code of “a”. Perhaps someone can find out more ???

In any case if you try to compile the object after the reopening, it will return an error massage stating that the maximum number of characters is 2!! [:D] Very, very funny!! Marco

quote:


Originally posted by MartinR
It also works with text fields. Text := Text::a After saving that you will find Text := Text::“97” 97 is the ASCII code of “a”. Perhaps someone can find out more ???


Solution for code fields: Take the ASCII code from the uppercase (!!!) letter, multiply it by 256 and then add 255 to that. Example: a → A → 65, * 256 = 16640, + 255 = 16895 Seems like Navision generates a 2-digit HEX number. Perhaps it has to do with the internal storage of code fields in the database ?

Hi, If you see the Navision Help for CODE datatype, you will get the clear idea how Navision maintain values for this data type internally.