IF-THEN - Problem

HI, I want to get a “IF-THEN”-relation between a code field at its value. IF the value in my code-field is “xy” THEN DoSomething, like print the output or not. The propblem is that my value has a length of 3 characters and I get the message that the text in code fields can have only a length of 2. I tried it at this way. (“Posting Group”=“Posting Group”::RAW) Edited by - aurelie on 2001 Aug 06 22:51:27

Most likely you are trying to do something in the wrong way (also based on your other postings). Just post an example of your non-working code, and you’ll be amazed how quickly it will be corrected by the forum members. Now, it’s a bit guessing in the dark what you are doing and why such a basic function isn’t doing what you expect. John

Hi! Hi John, I try to solve the riddle IF the problem is the length of the code field THEN you could redefine that property. In your example “Posting Group” could not be a Code-Field but an Option-Field! The value of an Option-Field is allways a number (!), IF you need to get the text/code of an Option-field THEN you have to use the FORMAT-Function. Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP

Ah, you edited the original post. Now it’s a bit more clear what you’re doing, and what’s wrong with it. To compare the content of a text or code field against some value, you only have to do: IF MyTextField = ‘SomeValue’ then DoSomething else DoSomethingElse; For a numerical compare, you do: IF MyNumberField = SomeNumber then DoThis else DoThat; Only when the field is an Option field, then you can use the special compare methode for option fields: IF MyOptionField = MyOptionField::PossibleOptionValue then TakeSomeAction; However, when you want to start some serious programming, ask your NSC for the C/AL Programming Guide (published by Navision), where all basic statements, methods and functions are described and explained. Be aware that you’re working with a sophisticated, carefully designed software package. Messing up is easily done, with possibly disasterous results. Are you fully convinced to be equipped with sufficient knowledge and skills to do the job? Wouldn’t you rather call in for some assistance by you NSC? John

John, i think you hit the nail on this topic. Thanks. Soren Nielsen, moderator Integration/Developer NOLUG