Pages

Sunday 12 May 2013

MSD Navision Table and Field Property

Table Properties
A table in C/SIDE has a number of properties that determine the behavior of the table. When you create a table, C/SIDE automatically defines a number of default values for these properties.
Property name
Use
ID Property
Sets a unique identifier for the table.
Name Property
Defines the table name, which is used as the table caption.
Caption Property
Displays the table caption in the currently selected language. This value is taken from the CaptionML Property, if a value is set.
CaptionML Property
Provides the text that is used to identify a control or other object in the user interface. This property is multilanguage enabled and can contain a list of text in different languages. The text that is actually used is selected according to the current language setting of the user.
Description Property
Include an optional description of the table. This description is for internal purposes only and is not visible to the end user. A short description of the table’s purpose makes it easier to maintain the application.
DataPerCompany Property
Determines whether data in this table is available to all companies or only the current company.
Yes if data is available only to this company; otherwise, No. The default value is Yes.

Microsoft Dynamics NAV Numeric Function


POWER Function (NUMBERS)
Raises a number to a power. For instance you can use this function to square the number 2 to get the result, 4.
NewNumber := POWER(Number, Power)
Example
Text constant
ENU value
Text000
'%1 raised to the power of %2 = %3'
Text001
'%1 raised to the power of %2 = %3'
Text002
'%1 raised to the power of %2 = %3'
Number1 := 2;                                   Power1 := 8;
Number2 := 100;                              Power2 := 0;
Number3 := 5;                                   Power3 := 0.5;
 
Res1 := POWER(Number1, Power1);
Res2 := POWER(Number2, Power2);
Res3 := POWER(Number3, Power3);
 
MESSAGE(Text000, Number1, Power1, Res1)
MESSAGE(Text001, Number2, Power2, Res2);
MESSAGE(Text001, Number3, Power3, Res3);

The message windows display the following:
2 raised to the power of 8 = 256
100 raised to the power 0 = 1
5 raised to the power of 0.5 = 2.2360679775
The last message window shows that raising a number to the power of 0.5 corresponds to the square root of the number.

Microsoft Dynamics NAV String Function


CONVERTSTR Function (STRING)
CONVERTSTR Function is used to converts some characters in a string.

NewString := CONVERTSTR(String, FromCharacters, ToCharacters)

·         The characters in the FromCharacters parameter are replaced by the characters in the ToCharacters parameter.
·         A run-time error occurs if the lengths of the FromCharacters and ToCharacters strings are not equal.
·         If either the FromCharacters or the ToCharacters strings are empty the source is returned unchanged.

Example
OriginalString     :=            'Want to leave without saving?'
FromChars          :=           ‘lws’
ToChars                :=            ‘LWS’

NewString := CONVERTSTR(OriginalString, FromChars, ToChars);
MESSAGE (OriginalString);           ->     Want to leave without saving?
MESSAGE(NewString);                  ->    Want to Leave Without Saving?

COPYSTR Function (STRING)
COPYSTR function is used to copies a substring of any length from a specific position in a string (text or code) to a new string.

NewString := COPYSTR(String, Position [, Length])

·         If you omit Length, the resulting string includes all the characters from Position to the end of the string.
·         If Position is less than 1 or Length is less than 0, an error is returned.
·         If Position is beyond the length of the current string, an empty string is returned.
·         If Position combined with Length exceeds the length of the string, all the characters from Position to the end of the string are returned.
Example
Str             := 'Using the COPYSTR function';
Position   := 7;
Length := 8;

NewStr := COPYSTR(Str, Position, Length); 

MESSAGE(Str);                                   -> Using the COPYSTR function
MESSAGE(NewStr);       -> the COPY