Tip: Where am I?

Here is a very simple tip.

These days, In NAV 2009, you got the RoleTailored Client, the Classic Client, web service and the NAS Server. So, you got more "clients", "environments", … or how you kids call it these days … then you had in 5.0.

Now, you can trigger each environment you want in code. This might be helpful when you want certain things to behave differently in a specific environments.

You only need two statements … and combine them:

  • GUIALLOWED: you already know this for a long time. In previous versions, this statement was called to "avoid the User Interface" (like dialogs and forms).
  • ISSERVICETIER: this is a "new" one since NAV 2009. This one tells you whether if code is executed on the ser vice tier or not … or in other words … when you're using the service tier in this specific case, environment, … or not.

If you combine these two statements, then you can very easily figure out "where you are", like this:

IF ISSERVICETIER THEN BEGIN
 
IF GUIALLOWED THEN
   
//RTC
 
ELSE
   
//WEBSERVICE
END
ELSE BEGIN
 
IF GUIALLOWED THEN
   
//CLASSIC
 
ELSE
   
//NAS 
END;

Like I said … it was a small (but may be useful) tip.

If you're looking for a certain applicable area … may be you would like to avoid printing a report for printing it in the classic environment.

Comment List
Related
Recommended