Create a codeunit from a code

tpriyan
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...
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...
0
Comments
-
Hi
Select menu File/Import, change File types on *.txt and Import this C/AL code. Compile and run it.0 -
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.0 -
Thanks a lot guys........0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions