Create a codeunit from a code

tpriyantpriyan Member Posts: 32
Hi all,
Suppose i have a code given below

OBJECT Codeunit 50000 PI
{
OBJECT-PROPERTIES
{
Date=31-10-07;
Time=12:08:00;
Modified=Yes;
Version List=;
}
PROPERTIES
{
OnRun=BEGIN
r := 10000; // must be more for high precision

// some initialize...
_r2 := r * r;
i := 0;
k := 0;

// go...
@');
WHILE i <= r DO BEGIN
w.UPDATE(1,ROUND(10000*i/r,1));
_i2 := i * i;
j := 0;
REPEAT
k += 1;
j += 1;
_j2 := j * j;
_t2 :=_i2 + _j2;
UNTIL _t2 > _r2;
i += 1;
END;
w.CLOSE;

// last calc...
d := 4 * k / _r2;

// result
MESSAGE('PI = %1',d);
END;

}
CODE
{
VAR
i@1000 : BigInteger;
j@1001 : BigInteger;
k@1002 : BigInteger;
d@1003 : Decimal;
r@1004 : BigInteger;
w@1005 : Dialog;
_i2@1006 : BigInteger;
_j2@1007 : BigInteger;
_r2@1008 : BigInteger;
_t2@1009 : BigInteger;

BEGIN
{
// Yaroslav Gaponov
}
END.
}
}


What do i have to do to transform it into a code unit object...I am very new to navision....

Thanks in advance...

Comments

  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    Hi

    Select menu File/Import, change File types on *.txt and Import this C/AL code. Compile and run it.
  • ara3nara3n Member Posts: 9,256
    You go to Tools-> Object Designer, Then File->Import shows up.

    The Object designer is where all the objects stored.
    Once you've imported the txt file. You need to Find it by click the codeunit button and then search for the ID 50000
    Once you found it. Select the record and HIT F11. This will compile it.

    Then you click on run to run it.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • tpriyantpriyan Member Posts: 32
    Thanks a lot guys........
Sign In or Register to comment.