How to now the server name

RODRIGUELEVESQUEJRRODRIGUELEVESQUEJR Member Posts: 13
edited 2005-05-17 in Navision Attain
Hi,

I need to now the name of the server when in Navision.
It would help me to now to witch personne to send a email, when I am in developpement or production?

Can I get some help.

I have tryed EX: string:=ENVIRON('ComputerName') but it gives me the computer name not the server name. Is there a environmental variable to now the server name?

I have tryed with CONTEXTURL but I get an specified an unknown variable message.

Help me please.

Comments

  • RODRIGUELEVESQUEJRRODRIGUELEVESQUEJR Member Posts: 13
    I am sory I am new to forums.
    I have tryed with CONTEXTURL but I get an specified an unknown variable message.
    I have the 2.6 version.
    Can we do something?
  • SavatageSavatage Member Posts: 7,142
    did you download the code? Please tell everyone what your error message is (exactly) we can't guess.
    OBJECT Codeunit 50000 Get servername
    {
      OBJECT-PROPERTIES
      {
        Date=27/02/03;
        Time=16:20:56;
        Modified=Yes;
        Version List=mibuso.com HowTo2;
      }
      PROPERTIES
      {
        OnRun=BEGIN
                IF CONFIRM(fctGetServerName) THEN;
                IF CONFIRM(fctGetServerType) THEN;
              END;
    
      }
      CODE
      {
    
        PROCEDURE fctGetServerName@1000000000() : Text[30];
        VAR
          ltxtTemp@1000000000 : Text[250];
          i@1000000001 : Integer;
        BEGIN
          ltxtTemp := CONTEXTURL;
          IF CONFIRM(ltxtTemp) THEN;
          i := STRPOS(ltxtTemp,'servername=');
          IF i > 0 THEN BEGIN
            ltxtTemp := COPYSTR(ltxtTemp,i + 11,999);
            i := STRPOS(ltxtTemp,'&');
            EXIT(COPYSTR(ltxtTemp,1,i - 1));
          END
          ELSE
            EXIT('');
        END;
    
        PROCEDURE fctGetServerType@1000000001() : Text[30];
        VAR
          ltxtTemp@1000000000 : Text[250];
          i@1000000001 : Integer;
        BEGIN
          ltxtTemp := CONTEXTURL;
          i := STRPOS(ltxtTemp,'servertype=');
          IF i > 0 THEN
            EXIT(COPYSTR(ltxtTemp,i + 11))
          ELSE
            EXIT('');
        END;
    
        BEGIN
        END.
      }
    }
    

    500 wow I must have lots o free time :mrgreen:
  • RODRIGUELEVESQUEJRRODRIGUELEVESQUEJR Member Posts: 13
    Here is the full message that I have when I save the Codeunit 50000 Get Servername with the compiled option checked.

    Message =

    You have specified an unknown variable.

    CONTEXTURL

    Define the variable under 'Global C/AL Symbol's.

    What can I do?
  • SavatageSavatage Member Posts: 7,142
    Starting from Navision Attain 3.01, the C/AL function CONTEXTURL is available. This function returns a context string that defines the current position of the running objects.

    This is one of the reasons their are different forums for different versions.

    Please do not post in every forum.

    Ok, now...Did you search the forum?
    Any 2.6 Financial Gurus out there have any ideas?
  • SavatageSavatage Member Posts: 7,142
    How about this?

    http://www.mbsonline.org/forum/topic.as ... servername

    David Singleton's method of seeing the virtual tables works for me.
  • krikikriki Member, Moderator Posts: 9,112
    You might use table 2000000010. This is the table with the database files in it, not the servername. But maybe it is usefull, specially if you name the DB like the servername. But it only works for a native DB, not for SQL-DB.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.