'case of' question

I have to do such test : if MyFieldNo = 50000 THEN blablabla… else if MyFieldNo = 50001 THEN blablabla… else blablabla… I tried to use a ‘case of’ structure case MyFieldNo of 50000: blablabla… 50001: blablabla… end; Do you know how to code the other cases ? I try this, but it don’t work : case MyFieldNo of 50000: blablabla… 50001: blablabla… OTHER: blablabla… end; Any Idea ? Of course, i have more than 2 possible values… [:)]

 Case MyFieldNo of 50000: blablabla1; 50001: blablabla2; else blablabla3; end; 

You can also have more complex statements like: CASE color OF Color::Orange**,**Color::Green: // use the comma for multiple values **BEGIN** blablabla; blablabla; END; Color::Blue: blablabla; ELSE blablabla; END; or CASE **TRUE** OF Quantity = 0: EXIT; Quantity < 0: MESSAGE('< 0'); Quantity **IN [50000..60000]**: MESSAGE('IN 50000..60000'); ELSE MESSAGE('not found'); END; Those samples are from the Programming Guide - C/AL Programming, 12-2

quote:


Originally posted by lbassompierre Do you know how to code the other cases ? I try this, but it don’t work : case MyFieldNo of 50000: blablabla… 50001: blablabla… OTHER: blablabla… end;


No offense, but if you are asking this sort of question, are you certain you should be developing software at all?

quote:


Originally posted by jhoek No offense, but if you are asking this sort of question, are you certain you should be developing software at all?


You might not believe it, but there are countries where manuals are nowhere to be found; when they can be found they are, of course, in English, which is not really a problem, we all can read English, but we still have the bad habit to think in our mother language, which doesn’t help; NTRs are often too busy to really listen to our questions; sometimes we are too busy to attend teaching classes. Nevertheless we have work to do and we need to manage somehow. I myself have learned much more about developping by lurking here than through all the official stuff; in my early times as a Navision developper I might have asked questions even more naive than that. Now I don’t think myself as a genius, but I believe I can work my way decently. Please, smart ones, don’t scare away the beginners. [}:)] Anna

quote:


Originally posted by Anna Perotti Please, smart ones, don’t scare away the beginners. [}:)]


You are right. My apologies for phrasing my thoughts the way I did. What I am afraid of is a situation where the “smart ones” become less and less interested in the forum if they have to wade through tons of beginnner’s questions. Whatever can be looked up in a manual should not be a subject in this forum, as far as I am concerned.

Oh Yeah, in jurassic versions of Navision there was no help avalaible for some statements like ‘CASE’. A lot of people had to learn this ones by themselves, me too. So, the right advice is to read all the manuals and helps, but it’s extremely important to find adn study all the tricks in the standard code of Attain/Navision. I mean, code in codeunits, forms, tables… …and to visit forum like this! So… Ar u experienced? Well, i am… Jimi rulez.

For those people who don’t have access to the manuals, you can always try to find an example of what you are looking for in Navision’s code. The best manual is Codeunit 80 [:)]