tag:blogger.com,1999:blog-2600521111465821802024-03-13T21:25:13.352+05:30NavisionWorldThis Blog is mainly Intended to Discuss About Microsoft Dynamics Nav(Formerly Navision)and To Post Informations on Different Topics,Aspects and also to help all those people who are Familiar,Uses and Work in Microsoft Dyanamics Nav.Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.comBlogger33125tag:blogger.com,1999:blog-260052111146582180.post-8787052567557195072009-07-29T16:11:00.003+05:302009-07-30T17:03:48.045+05:30C/SIDE Concepts<strong><u>Description of C/SIDE Concepts</u></strong><br /><br /><strong>Properties</strong><br />Properties control the appearance and behavior of the application objects and all their sub-objects. Properties are used to control the appearance of data, specify default values, specify colors, and define relationships.<br /><br /><strong>C/AL</strong><br />C/AL is the language you use to write functions in C/SIDE. In the previous table, "C/AL" refers to functions written in this language.<br /><br /><strong>Triggers</strong><br />A trigger is a mechanism that is built into an application object. When certain actions are performed on the application object, the trigger initiates an action. You can add your own C/AL code to the trigger to modify the default behavior of the application object or extend its functionality.<br /><br /><strong>Keys</strong><br />Keys define the order in which data is stored in your tables. You can speed up searches in tables by defining several keys which sort information in different ways.<br /><br /><strong>Fields</strong><br />A field is the smallest building block in your database. A field typically stores information such as a name or a number.<br /><br /><strong>Controls</strong><br />Controls are objects on a form or report that display data, perform actions, or enhance the appearance of the form, such as command buttons and text labels.<br /><br /><strong>Request Form</strong><br />A request form is a form that is used in a report. Before a report is run, a request form is displayed to let the user specify filters and options for the report.<br /><br /><strong>Template</strong><br />A template defines the overall layout of a report.<br /><br /><strong>Data Items</strong><br />A data item is a building block for defining a model of your data when you create a report. You use a hierarchy of data items to define which data the report will contain. A data item represents a table, and when you run a report, the system cycles through the records in the associated table. A data item can have one or more sections.<br /><br /><strong>Sections</strong><br />A section is a substructure of a data item, where you place controls to display information. You will typically use sections that define the body, header, and footer in your report.Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-41874654467535074462009-07-29T16:06:00.001+05:302009-07-29T16:08:40.295+05:30Object-Oriented vs. Object-Based<div align="justify">C/SIDE is not object-oriented but object-based. This is an important distinction. In an object-oriented language or environment, a developer can create new types of objects based on the ones already in the system. In Microsoft Dynamics NAV, you can only create objects that are either tables, forms, pages, reports, dataports, XMLports, codeunits, or menu suite objects.Because there are a limited number of application objects, C/SIDE works faster and more efficiently. The greatest benefit is the Stability.</div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-19462058241558469292009-07-29T15:51:00.004+05:302009-07-29T16:05:22.698+05:30Object Designer<div align="justify">The Object Designer is the main tool for developing C/SIDE applications. This tool allows you to do the following:<br />. Design new tables, forms, pages, reports, dataports, XMLports, menusuites and codeunits.<br />. View existing application objects.<br />. Modify existing application objects.<br />. Run an application object (with the exception of XMLports, menusuite objects and pages).<br /><br /></div><p align="justify"><a href="http://3.bp.blogspot.com/__ZOn86FIZsU/SnAjkPEIglI/AAAAAAAAAEM/iiEpsNEkoxc/s1600-h/Object+Designer.JPG"><img id="BLOGGER_PHOTO_ID_5363826261624390226" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 155px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/__ZOn86FIZsU/SnAjkPEIglI/AAAAAAAAAEM/iiEpsNEkoxc/s320/Object+Designer.JPG" border="0" /></a><strong><u> Tools in the Object Designer</u></strong><br />The following table lists the tools that are available in the Object Designer.</p><p align="justify"><strong><u>Tool - Designed for </u></strong></p><p align="justify">Table Designer - Tables<br />Form Designer - Forms<br />Page Designer - Pages<br />Report Designer - Reports<br />Dataport Designer - Dataports<br />XMLport Designer - XMLports<br />C/AL editor - Codeunits<br />Navigation Pane Designer - MenuSuite objects</p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-55352672825882505442009-07-27T15:09:00.002+05:302009-07-27T15:17:58.661+05:30C/SIDE FundamentalsHere I am giving an Introduction to user interface and to some of the basic concepts that are relevant to application design such as the different object types.<br />C/SIDE applications are based on certain application objects. They are<br /><strong><u>Table</u></strong><br />You use tables to store data. For example, a business application usually contains a customer table that stores information about each customer.Understanding tables is the key to using all the other objects.<br /><strong><u>Form</u></strong><br />You use forms to access the information that is stored in the tables. You use forms when you enter new information and when you view information that already exists in the database.<br /><strong><u>Report</u></strong><br />You use reports to present information. You use filters and sorting to select the data that you want to present in a report.<br /><strong><u>Dataport</u></strong><br />You use dataports to import data from and export data to external text files.<br /><strong><u>Codeunit</u></strong><br />A codeunit contains user-defined functions written in C/AL code. C/AL is the application language you use to write functions in C/SIDE. The functions that a codeunit contains can be used from the other objects in your application. This helps to minimize application size because the same code can be reused.<br /><strong><u>MenuSuite</u></strong><br />A MenuSuite object contains the set of menus that are displayed in the Navigation Pane.<br /><strong><u>Page</u></strong><br />Pages have the same functionality as forms but are intended to run on the RoleTailored client. A page can be role tailored, to suite a users needs.Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-2127083771715296772009-07-27T14:53:00.003+05:302009-07-27T15:02:37.930+05:30Zoom Funtion In Navision<div align="justify"><a href="http://4.bp.blogspot.com/__ZOn86FIZsU/Sm1z2f0fAaI/AAAAAAAAAEE/it8OFqO67as/s1600-h/Nav+Image.JPG"><img id="BLOGGER_PHOTO_ID_5363070111359893922" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 211px" alt="" src="http://4.bp.blogspot.com/__ZOn86FIZsU/Sm1z2f0fAaI/AAAAAAAAAEE/it8OFqO67as/s320/Nav+Image.JPG" border="0" /></a> In the Classic client, you use the Zoom feature on a form to view all fields for the current record that are in the table on which the form is based. For example, if you open a sales order form, click the Tools menu, and then click Zoom, then the Sales Header - Zoom window opens. The Sales Header - Zoom window shows all fields in the Sales Header table and the value of each field for the current record.</div><div align="justify">You can use the Zoom feature in the Classic client to help you troubleshoot and debug issues. For example, if you create a new form and need to troubleshoot the data that is displayed on the form, then you can use the Zoom feature to view all fields for the current record.<br /></div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com1tag:blogger.com,1999:blog-260052111146582180.post-65804923627966877052009-07-27T14:31:00.003+05:302009-07-27T14:52:08.944+05:30WITH Statements<div align="justify">Following is the Syntax For WITH statment.</div><div align="justify"><strong>WITH [Record] DO [Statement]</strong></div><div align="justify">When you work with records, addressing is created as record name, dot (period),<br />and field name: [Record].[Field]<br />you work continuously with the same record, you can use WITH statements. When you use a WITH statement, you only have to specify the record name once.<br />Within the scope of [Statement], fields in [Record] can be addressed without having to specify the record name.<br />You can nest several WITH statements. In case of identical names, the inner WITH overrules the outer WITH-statements.</div><div align="justify"><strong><u>For Eg:</u></strong></div><div align="justify">Consider a variable-'CustRec', Data Type -'Record', Subtype-'Customer'.</div><div align="justify">CustRec."No." := '10000';</div><div align="justify">CustRec.Name := 'Creative Solutions';</div><div align="justify">CustRec."Phone No." := '555-444-333';</div><div align="justify">CustRec.Address := '1352 Avenue';</div><div align="justify">CustRec.City := 'NewYork City';</div><div align="justify">MESSAGE('A variable has been created for this customer.');</div><div align="justify">The following example shows another way to create a record variable that you can commit later.</div><div align="justify">WITH CustomerRec DO</div><div align="justify">BEGIN </div><div align="justify">"No." := '10000';</div><div align="justify">Name := 'Creative Solutions';</div><div align="justify">"Phone No." := '555-444-333'; </div><div align="justify">Address := '1352 Avenue'; </div><div align="justify">City := 'NewYork City';</div><div align="justify">MESSAGE('A variable has been created for this customer.');</div><div align="justify">END;</div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-40573475840457618802009-07-25T14:55:00.004+05:302009-07-25T15:14:59.199+05:30FOR,WHILE,REPEAT<div align="justify"><strong><u>C/AL Repetitive Statements</u></strong><br />A repetitive statement is also known as a loop. The Different Loop statements are Given below.<br />1. FOR<br />2. WHILE<br />3. REPEAT<br /><br /><strong><u>FOR</u></strong><br />Repeats the inner statement until a counter variable equals the maximum or minimum value specified. </div><div align="justify">The Two Control Structures In FOR Statement are <strong>FOR TO</strong> and <strong>FOR DOWNTO</strong>.<br />The Syntax For The above control structures are given below.<br />FOR [Control Variable] := [Start Number] TO [End Number] DO<br />[Statement]<br />The data type of [Control Variable], [Start Number], and [End Number] must be Boolean, number, time, or date.<br />Use FOR statements when you want to execute code a specific number of times.<br />Use a control variable to control the number of times the code is executed. The control variable can be increased or decreased by one, depending on whether TO or DOWNTO is used.<br />When using a FOR TO loop, the [Statement] will not be executed if the [Start Number] is greater than the end value. Likewise, when using a FOR DOWNTO loop, the [Statement] will not be executed if the [Start Number] is less than the end value.<br /><strong><u>For Eg:</u></strong><br />1. Consider a variable 'I' for Loop.<br />FOR I=1 To 5 DO<br />Statement 1;<br />2. The following example shows how to nest FOR statements.<br />FOR I := 1 TO 5 DO<br />FOR J := 1 TO 7 DO<br />A[I,J] := 23;</div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-55458256027692288692009-07-23T15:07:00.009+05:302009-07-25T12:23:27.608+05:30IF THEN ELSE in Navision<div align="justify"><strong><u>IF THEN [ELSE]</u></strong></div><div align="justify">A conditional statement is one type of control structure in C/AL.</div><div align="justify"><strong>Using Conditional Statements</strong><br />By using a conditional statement, you can specify a condition and one or more commands that should be executed, according to whether the condition is evaluated as TRUE or FALSE. There are two types of conditional statements in C/AL:<br />1. <strong>IF THEN [ELSE]</strong>, where there are two choices<br />2. <strong>CASE</strong>, where there are more than two choices.</div><div align="justify"><strong>IF THEN ELSE Statements</strong><br />IF THEN ELSE statements have the following syntax.</div><div align="justify">IF (Condition) THEN (Statement1) </div><div align="justify">[</div><div align="justify">ELSE </div><div align="justify">(Statement2)</div><div align="justify">]<br />This means that if (Condition) is true, then (Statement1) is executed. If (Condition) is false, then (Statement2) is executed.<br />The square brackets around ELSE <statement2>mean that this part of the statement is optional. The ELSE statement is used when different actions are executed, depending on the evaluation of (Condition).<br />You can build even more complex control structures by nesting IF THEN ELSE statements. The following example is a typical IF THEN ELSE statement.</div><div align="justify">IF (Condition1) THEN </div><div align="justify">IF (Condition2) THEN </div><div align="justify">Statement1; </div><div align="justify">ELSE </div><div align="justify">Statement2</div><div align="justify"><strong>Note: A semicolon preceding an ELSE is not allowed.</strong><br />If 'Condition1' is false, then nothing is executed. If 'Condition1' and 'Condition2' are both true, then 'Statement1' is executed. If 'Condition1' is true and 'Condition2' is false, then 'Statement2' is executed.</div><div align="justify">Reading several nested IF THEN ELSE statements can be quite confusing but a general rule is that an ELSE belongs to the last IF that lacks an ELSE.</div><div align="justify"><strong>Example 1<br /></strong>The following example shows an IF statement without the optional ELSE part.</div><div align="justify">IF Amount (<) 1000 THEN Total := Total + Amount; <div align="justify"><strong>Example 2</strong><br />The following example shows an IF statement with the optional ELSE part.</div><div align="justify">(1)...</div>(2) IF Amount (<1000) align="justify">(3) THEN BEGIN</div><div align="justify">(4) IF I > J THEN Max := I</div><div align="justify">(5) ELSE Max := J; </div><div align="justify">(6) Amount := Amount * Max; </div><div align="justify">(6) END </div><div align="justify">(7) ELSE </div><div align="justify">(8)...<br />A common error is to put an extraneous semicolon at the end of a line before an ELSE (line 4). As mentioned earlier, this is not valid according to the syntax of C/AL. The semicolon is used as a statement separator. (The end of line 4 is inside the inner IF statement.)</div><div align="justify"></div><div align="justify"><strong><u>CASE Statements</u></strong><br />CASE statements have the following syntax.</div><div align="justify"></div><div align="justify">CASE (Expression) OF</div><div align="justify">(Value set 1) : (Statement 1);</div><div align="justify">(Value set 2) :(Statement 2);......</div><div align="justify">(Value set n) : (Statement n);</div><div align="justify">[ ELSE (Statement n+1) ]</div><div align="justify"></div><div align="justify">CASE statements are also called multiple option statements and are typically used when you must choose between more than two different actions.</div><div align="justify">The function of the CASE statement is as follows:<br />1. The 'Expression' is evaluated, and the first matching value set executes the associated statement, if there is one.<br />2. If none of the value sets matches the value of the expression, and the optional ELSE part has been omitted, no action is taken. If the optional ELSE part is used, then the associated statement is executed.<br />The data type of the value sets must be the same as the data type of 'Expression' or at least be convertible to the same data type.</div><div align="justify"></div><div align="justify"><strong><u>For Eg:</u></strong></div><div align="justify">The following C/AL code prints various messages depending on the value of Number. If the value of Number does not match any of the entries in the CASE structure, the ELSE entry is used as the default.</div><div align="justify"></div><div align="justify">CASE Number OF </div><div align="justify">1,2,9: MESSAGE('1, 2, or 9.'); </div><div align="justify">10..100: MESSAGE('In the range from 10 to 100.');</div><div align="justify">ELSE MESSAGE('Neither 1, 2, 9, nor in the range from 10 to 100.');</div><div align="justify">END</div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-86966984013814303292009-07-23T14:51:00.004+05:302009-07-25T12:23:59.932+05:30BEGIN END Statements<div align="justify">A compound statement is one type of control structure in C/AL.<br />Using Compound Statements, In some cases, the C/AL syntax only allows you to use a single statement.<br />If however you have to execute more than one simple statement, the statements can be written as a compound statement by enclosing the statements between the keywords BEGIN and END. </div><div align="justify"></div><div align="justify">BEGIN<br /><statement>Statement 1;<br /><statement>Statement 2;</div><div align="justify">.. <statement>;<br />END </div><div align="justify"><br />The individual statements are separated by a semicolon. In C/AL a semicolon is used to separate statements, and not, as in other programming languages, as a terminator symbol for a statement. Nevertheless, an extra semicolon before an END does not cause an error because it is interpreted by the compiler as an empty statement.<br /><strong>Blocks</strong><br />The BEGIN-END structure is also called a block. Blocks can be very useful in connection with the other control structures in C/AL</div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-24500707578616012412009-07-21T15:44:00.002+05:302009-07-23T14:12:50.603+05:30C/AL Control Structures<div align="justify">All the C/AL programs that you create consist of one or more statements, which are executed sequentially in top-down order. However, you will often need to control the direct top-down flow of the execution. One or more statements may have to be repeated more than once, or you may have to make the execution of a certain statement conditional. To do this, you use control structures.<br /><br />The control structures in C/AL are divided into the following main groups:<br /><br /> 1. Compound statements<br /><br /> 2. Conditional statements<br /><br /> 3. Repetitive statements<br /><br /> 4. WITH statements<br /><br /></div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-16671819213361379742009-07-21T15:33:00.002+05:302009-07-21T15:38:48.478+05:30System-Defined Variables<p align="justify">C/SIDE automatically declares and initializes a number of variables that you can use when you develop applications. The following details describes the system-defined variables.</p><p align="justify"><strong><u>Rec</u></strong></p><p align="justify">When a record is modified, this variable specifies the current record, including the changes that are made.</p><p align="justify"><strong><u>xRec</u></strong></p><p align="justify">When a record is modified, this variable specifies the original values of the record, before the changes.</p><p align="justify"><strong><u>CurrForm</u></strong></p><p align="justify">This variable specifies the current form. You can access the controls of the form through this variable and set the dynamic properties of the form and its controls.</p><p align="justify"><strong><u>CurrReport</u></strong></p><p align="justify">This variable specifies the current report.</p><p align="justify"><strong><u>RequestOptionsForm</u></strong></p><p align="justify">This variable specifies the request options form for the current report.</p><p align="justify"><strong><u>CurrFieldNo</u></strong></p><p align="justify">This variable specifies the field number of the current field in the current form. Retained for compatibility reasons.</p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-66553685535951210292009-07-21T15:07:00.003+05:302009-07-21T15:29:43.255+05:30Accounts in General Posting Setup<p align="justify">The description and use of Different GL Accounts in General Setup is given below.</p><p align="justify"><strong><u>Direct Cost Applied Account -</u></strong></p><p align="justify">To post direct cost incurred in purchasing materials, capacity and subcontractor's services.</p><p align="justify"><strong><u>Overhead Applied Account -</u></strong></p><p align="justify">To post indirect cost incurred in purchasing materials, capacity and subcontractor's services.</p><p align="justify"><strong><u>Inventory Account -</u></strong></p><p align="justify">To post inventory value of purchased items and manufactured items.</p><p align="justify"><strong><u>Purchase Variance Account -</u></strong></p><p align="justify">To post the difference between standard cost and direct cost of purchased inventory.</p><p align="justify"><strong><u>Inventory Account (Interim) -</u></strong></p><p align="justify">To post expected inventory value. Use together with Inventory Accrual Account (Interim).</p><p align="justify"><strong><u>WIP Account - </u></strong>To post value of WIP Inventory.</p><p align="justify"><strong><u>Manufacturing Overhead Variance Account -</u></strong></p><p align="justify">To post the difference between actual overhead cost incurred in manufacturing the item and the standard overhead cost for the item.</p><p align="justify"><strong><u>Capacity Overhead Variance Account -</u></strong></p><p align="justify">To post the difference between the overhead cost of capacity consumed and the overhead (standard) cost of capacity setup in the routing for the manufactured item.</p><p align="justify"><strong><u>COGS Account (Interim) -</u></strong></p><p align="justify">To post expected inventory decrease due to sales. Expected sales is posted when post ship without invoice. When Invoice is posted, cost in COGS (Interim) will be reversed out and posted to COGS account.</p><p align="justify"><strong><u>Inventory Adjustment Account -</u></strong></p><p align="justify">To post inventory increase / decrease due to adjustement, revaluation and rounding</p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-82768361074707053412009-07-18T16:43:00.002+05:302009-07-23T14:25:15.724+05:30Bulk Inserts<strong><u>Bulk Inserts<br /></u></strong>Microsoft Dynamics NAV automatically buffers inserts in order to send them to SQL Server at one time. By using bulk inserts the number of server calls is reduced, thereby improving performance. Bulk inserts also improve scalability by delaying the actual insert until the last possible moment in the transaction. This reduces the amount of time that tables are locked; especially tables that contain SIFT indexes.<br />Application developers who want to write high performance code that utilizes this feature should understand the following bulk insert constraints.<br /><br /><strong><u>Bulk Insert Constraints</u></strong><br />If you want to write code that uses the bulk insert functionality, you must be aware of the following constraints. Records are sent to SQL Server when the following occurs:<br />You call COMMIT to commit the transaction.<br />You call MODIFY or DELETE on the table.<br />You call any FIND or CALC methods on the table.<br />Records are not buffered if any of the following conditions are met:<br />The application is using the return value from an INSERT call; for example,<br />"IF (GLEntry.INSERT) THEN".<br />The table that you are going to insert the records into contains any of the following:<br />BLOB fields<br />Variant fields<br />RecordID fields<br />Fields with the AutoIncrement property set to Yes<br />The following code example cannot use buffered inserts because it contains a FIND call on the GL/Entry table within the loop.<br />IF (JnlLine.FIND('-')) THEN BEGIN<br />GLEntry.LOCKTABLE;<br />REPEAT IF (GLEntry.FINDLAST) THEN<br />GLEntry.NEXT := GLEntry."Entry No." + 1ELSEGLEntry.NEXT := 1;// The FIND call will flush the buffered records.GLEntry."Entry No." := GLEntry.NEXT ;<br />GLEntry.INSERT;<br />UNTIL (JnlLine.FIND('>') = 0)END;<br />COMMIT;<br />If you rewrite the code, as shown in the following example, you can use buffered inserts.<br />IF (JnlLine.FIND('-')) THEN BEGIN<br />GLEntry.LOCKTABLE;<br />IF (GLEntry.FINDLAST) THEN<br />GLEntry.Next := GLEntry."Entry No." + 1ELSEGLEntry.Next := 1;<br />REPEAT GLEntry."Entry No.":= GLEntry.Next;<br />GLEntry.Next := GLEntry."Entry No." + 1;GLEntry.INSERT;<br />UNTIL (JnlLine.FIND('>') = 0)END;<br />COMMIT;// The inserts are performed here.Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-8313700947778661622009-07-18T15:27:00.011+05:302009-07-25T12:29:02.153+05:30TESTFIELD & VALIDATE Functions<div align="justify"><strong><u>TESTFIELD Function</u></strong></div><div align="justify">TESTFIELD tests whether a field contains a specific value. It has the following syntax.</div><div align="justify"><strong>Record.TESTFIELD(Field, [Value])</strong></div><div align="justify">If the test fails, that is, if the field does not contain the specified value, an error message is displayed and a runtime error is triggered. This means that any changes that were made to the record are discarded. If the value that you test against is an empty string, the field must have a value other than blank or 0 (zero).</div><div align="justify">One of the main feature of this function is that, if you want to check any field where value is their or not, You can Use this function, So that without giving any data to that particular field, System won't allow the user to Post the document. For this you can simply write</div><div align="justify"><strong>TestField(Fieldname);</strong></div><div align="justify"></div><div align="justify"></div><div align="justify"><strong><u>VALIDATE Function</u></strong></div><div align="justify">VALIDATE calls the OnValidate trigger of a field. It has the following syntax.</div><div align="justify"><strong>Record.VALIDATE(Field [, NewValue])</strong></div><div align="justify"></div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-91759677395884842702009-07-18T14:58:00.003+05:302009-07-18T15:23:08.521+05:30CALCFIELDS, CALCSUMS Functions In Navision<div align="justify"><strong>CALCFIELDS</strong> updates FlowFields. FlowFields are automatically updated when they are the direct source expressions of controls, but they must be explicitly calculated when they are part of a more complicated expression.</div><div align="justify">CALCFIELDS has the following syntax.</div><div align="justify"><strong>[Ok :=] Record.CALCFIELDS(Field1, [Field2],...)</strong><br />When you use FlowFields in C/AL functions, you must use the CALCFIELDS function to update them.</div><div align="justify"><strong><u>For Eg:</u></strong></div><div align="justify">In the following example, the SETRANGE function sets a filter and then the CALCFIELDS function calculates the Balance and Balance Due fields by using the current filter and performing the calculations that are defined as the CalcFormula properties of the FlowFields.</div><div align="justify">Let the Variable Be <strong>'Customer'</strong>, Data Type be <strong>'Record'.</strong></div><div align="justify">Customer.GET(INDG-CUS-005); // Will Selct The Customer No: INDG-CUS-005 </div><div align="justify">Customer.SETRANGE("Date Filter",0D,TODAY); // Will set the date Range for the Present Dt</div><div align="justify">Customer.CALCFIELDS(Balance,"Balance Due"); // Using, Calcfields system calcs the balance as per Dt.</div><div align="justify">MESSAGE('The Balance is %1 and your Balance Due is %2',Customer.Balance,Customer."Balance Due"); // Will Displays the balance in a Message Box, with Corresponding Value.</div><div align="justify"></div><div align="justify"><strong><u>CALCSUMS Function</u></strong><br />CALCSUMS calculates the sum of one or more fields that are SumIndexFields in the record.<br />CALCSUMS has the following syntax.</div><div align="justify"><strong>[Ok :=] Record.CALCSUMS (Field1, [Field2],...)</strong></div><div align="justify">For CALCSUMS, a key that contains the SumIndexFields must be selected as the current key. Similar to CALCFIELDS, CALCSUMS uses the current filter settings when performing the calculation.</div><div align="justify"><strong><u>For Eg: </u></strong></div><div align="justify">Let the Variable be <strong>'CustLdgentry'</strong> & Datatype be <strong>'Record'</strong></div><div align="justify">CustLdgentry.SETCURRENTKEY("Customer No."); // will Set the Key Customer No.</div><div align="justify">CustLdgentry.SETRANGE("Customer No.",'50000','90000');// Will set Range of Customers No. From 50000-90000.</div><div align="justify">CustLdgentry.SETRANGE("Posting Date",0D,TODAY); // will Filter the posting date with Present date.</div><div align="justify">CustLdgentry.CALCSUMS("Sales (LCY)"); // Will Calculate total Sales Froam Sales(LCY) Field.</div><div align="justify">MESSAGE ('%1 calculated sales',custledgerentry."Sales (LCY)") // Total sales Amount in Local Currency Will be displayed in Message Box.</div><div align="justify"><strong><u></u></strong></div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-3812575369640991822009-07-18T14:24:00.006+05:302009-07-25T12:27:49.468+05:30How to Check the User Name Who Locked the Table?.<div align="justify">This is because at same time two different users are trying to modify the values in same table. For the integerity and security of data, Navision won't allow mutiple users to modify the values in same table at a time. If You wan't to know,from which User ID, the sytem had locked it, Please follow the below steps.<br />Navision allow you to check which user is locking other users.<br />Step 1 #. Go to File-->Database-->Information.<br />Step 2 #. Select the Sessions tab.<br />Step 3#. Drill down to the current sessions.<br />Step 4#. Check on the Blocking user id column to find out who is locking other people.</div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-878417835107252402009-07-16T15:00:00.003+05:302009-07-25T12:46:38.961+05:30GETRANGEMIN, GETRANGEMAX Functions<strong><u>GETRANGEMIN Function</u></strong><br /><br />GETRANGEMIN retrieves the minimum value of the filter range that is currently applied to a field.<br /><br />GETRANGEMIN has the following syntax.<br /><strong>Record.GETRANGEMIN(Field);</strong><br /><br />A runtime error occurs if the filter that is currently applied is not a range. For example, you can set a filter as follows.<br />Customer.SETFILTER("No.",'100002000030000');<br /><br />With this filter, the following code fails because the filter is not a range.<br /><p>BottomValue := Customer.GETRANGEMIN("No.");</p><p><strong><u>GETRANGEMAX Function</u></strong><br /></p>GETRANGEMAX retrieves the maximum value of the filter range that is currently applied to a field.<br /><br />GETRANGEMAX has the following syntax.<br /><strong>Value := Record.GETRANGEMAX(Field)</strong>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-8197290207956313972009-07-16T14:26:00.005+05:302009-07-16T14:53:00.107+05:30SETCURRENTKEY, SETRANGE, SETFILTER Functions.The following functions are used to filter records in a table: <br /><br /> #. SETCURRENTKEY<br /><br /> #. SETRANGE<br /><br /> #. SETFILTER<br /><br /><p>These functions are some of the most commonly used C/AL functions. They set limits on the value of one or more specified fields, so that only a subset of the records are displayed, modified, deleted, and so on.</p><p><strong><u>SETCURRENTKEY Function</u></strong><br /></p><br />SETCURRENTKEY selects a key for a record and sets the sort order that is used for the table in question.<br /><br />SETCURRENTKEY has the following syntax.<br /><strong>[Ok :=] Record.SETCURRENTKEY(Field1, [Field2],...)</strong><br /><br />When you use SETCURRENTKEY the following rules apply:<br /><br />Inactive fields are ignored.<br /><br />When searching for a key, the first occurrence of the specified field(s) is selected. This means the following:<br /><br />If you specify only one field as a parameter when you call SETCURRENTKEY, the key that is actually selected may consist of more than one field.<br /><br />If the field that you specify is the first component of several keys, the key that is selected may not be the key that you expect.<br /><br /><p>If no keys can be found that include the field(s) that you specify, the return value is FALSE. If you do not test the return value, a runtime error occurs. If you do test the return value, the program will continue to run even though no key was found. </p><p><strong><u>SETRANGE Function</u></strong><br /></p>SETRANGE sets a simple filter on a field.<br /><br />SETRANGE has the following syntax.<br /><strong>Record.SETRANGE(Field [,From-Value] [,To-Value]);</strong><br /><br />In the following example, SETRANGE filters the Customer table by selecting only those records where the No. field has a value between 10000 and 90000.<br />Customer.SETRANGE("No.",'10000','90000');<br /><br />When you use SETRANGE the following rules apply:<br /><br />SETRANGE removes any filters that were set previously and replaces them with the From-Value and To-Value parameters that you specify.<br /><br />If you use SETRANGE without setting the From-Value and To-Value parameters, the function removes any filters that are already set.<br /><p>If you only set the From-Value, the To-Value is set to the same value as the From-Value.</p><p><strong><u>SETFILTER Function</u></strong><br /></p><br />SETFILTER sets a filter in a more general way than SETRANGE.<br /><br />SETFILTER has the following syntax.<br /><strong>Record.SETFILTER(Field, String [, Value], ...];</strong><br /><br />Field is the name of the field on which you want to set a filter. String is the filter expression. String may contain placeholders, such as %1 and %2, to indicate where to insert the Value parameter(s) in a filter expression.<br /><br />The following example selects records where the value of No. is larger than 10000 and not equal to 20000.<br />Customer.SETFILTER("No.", '>10000 & <> 20000');<br /><br />If the variables Value1 and Value2 have been assigned "10000" and "20000" respectively, then you can use the following statement to create the same filter.<br />Customer.SETFILTER("No.",'>%1&<>%2',Value1, Value2);Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-72347839735862607562009-07-15T16:19:00.003+05:302009-07-25T12:38:47.714+05:30Code Differences in Locking procedure.<div align="justify"><strong><u>Locking Differences in the Code</u></strong><br /><br />A typical use of LOCKTABLE(TRUE,TRUE) in Classic Database Server is shown in the first of the following examples. The equivalent code for the SQL Server Option is shown in the second example. The code that works on both servers is shown in the third example. The RECORDLEVELLOCKING property is used to detect whether record level locking is being used. If this is the case, then you are using the SQL Server Option for Microsoft Dynamics NAV. This is currently the only server that supports record level locking.<br /></div><p align="justify"><strong><u>Classic Database Server</u></strong><br /></p><div align="justify"><strong>Example 1 </strong><br /></div><p align="justify">IF Rec.FIND('-') THEN<br /></p><div align="justify">REPEAT<br />UNTIL Rec.NEXT = 0;<br />Rec.LOCKTABLE(TRUE,TRUE);<br />IF Rec.FIND('-') THEN<br />REPEAT<br />Rec.MODIFY;<br />UNTIL Rec.NEXT = 0;<br /></div><p align="justify"><strong><u>SQL Server</u></strong><br /></p><p align="justify"><strong>Example 2 </strong><br /></p><div align="justify">Rec.LOCKTABLE;<br />IF Rec.FIND('-') THEN<br />REPEAT<br />UNTIL Rec.NEXT = 0;<br />IF Rec.FIND('-') THEN<br />REPEAT<br />Rec.MODIFY;<br />UNTIL Rec.NEXT = 0;<br /></div><p align="justify"><strong><u>Both Server Types</u></strong><br /></p><p align="justify"><strong>Example 3 </strong></p><p align="justify">IF Rec.RECORDLEVELLOCKING THEN<br /></p><div align="justify">Rec.LOCKTABLE;<br />IF Rec.FIND('-') THEN<br />REPEAT<br />UNTIL Rec.NEXT = 0;<br />IF NOT Rec.RECORDLEVELLOCKING THEN<br />Rec.LOCKTABLE(TRUE,TRUE);<br />IF Rec.FIND('-') THEN<br />REPEAT<br />Rec.MODIFY;<br />UNTIL Rec.NEXT = 0;</div>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-11171137714820638642009-07-15T15:38:00.003+05:302009-07-15T16:19:03.681+05:30Locking in Microsoft Dynamics NAVThis topic explains how locking is used in the two database options for Microsoft Dynamics NAV: <br /><br />1. Classic Database Server <br /><p>2. The SQL Server Option</p><p><strong>Both Server Options</strong></p><p><strong>Locking</strong><br /><br />In the beginning of a transaction, the data that you read is not locked. This means that reading data does not conflict with transactions that modify the same data. If you want to ensure that you are reading the latest data from a table, you must lock the table before you read it.</p><p><br /><strong>Locking Single Records</strong><br /><br />Usually, you must not lock a record before you read it even though you may want to modify or delete it afterward. When you try to modify or delete the record, you get an error message if another transaction has modified or deleted the record. You receive this error message because C/SIDE checks the timestamp that it keeps on all the records in a database and detects that the timestamp on the copy you have read is different from the timestamp on the modified record in the database.</p><p><strong>Locking Record Sets</strong><br /><br />Usually, you lock a table before reading a set of records in that table if you want to read these records again to modify or delete them. You must lock the table to ensure that another transaction does not modify these records.<br /><br />You will not receive an error message if you do not lock the table even though the records have been modified as a result of other transactions being carried out while you were reading them.</p><p><strong>Minimizing Deadlocks</strong><br /><br />To minimize the amount of deadlocks that occur, you must lock records and tables in the same order for all transactions. You can also try to locate areas where you lock more records and tables than you actually need, and then diminish the extent of these locks or remove them completely. This can prevent conflicts from occurring that involve these records and tables.<br /><br />If this does not prevent deadlocks, you can, lock more records and tables to prevent transactions from running concurrently.<br /><br />If you cannot prevent the occurrence of deadlocks by programming, you must run the deadlocking transactions separately.</p><p><strong><u>Locking in Microsoft SQL Server</u></strong><br /><br /><br />This topic explains how database locking works in Microsoft Dynamics NAV with Microsoft SQL Server.</p><p><strong>Locking in SQL Server</strong><br /><br />When data is read without locking, you get the latest (possibly uncommitted) data from the database. If you call Rec.LOCKTABLE, nothing happens. However, when data is read from the table after LOCKTABLE has been called, the data is locked.<br /><br />If you call INSERT, MODIFY, or DELETE, the specified record is locked immediately. This means that two transactions, which either insert, modify, or delete separate records in the same table do not conflict. Furthermore, locks are also placed when data is read from the table after the modifying function has been called.<br /><br />SumIndexFields are maintained when INSERT, MODIFY, or DELETE is called. SQL Server places locks on the records to be updated in the underlying Indexed View. For example, if the application contains a SIFT index on a key consisting of only 'AccountNo' then only one user at the time will be able to modify records on a given AccountNo.<br /><br />Even though SQL Server initially puts locks on single records, it can also choose to escalate a single record lock to a table lock. This will happen if the overall performance can be improved by not having to set locks on individual records. The improvement in performance must outweigh the loss in concurrency that this excessive locking causes.<br /><br />If you specify what record to read, for example, by calling Rec.GET, that record is locked. This means that two transactions, which read specific, but separate records in a table does not cause conflicts.<br /><br />If you browse a record set (read sequentially through a set of records), for example, by calling Rec.FIND('-') or Rec.NEXT, the record set (including the empty space) is locked as you browse through it. This means that two transactions, which just read separate sets of records in a table, will cause a conflict if there are no records between these two record sets. When locks are placed on a record set, other transactions cannot put locks on any record within the set.<br /><br />Note that C/SIDE determines how many records to retrieve from the server when you ask for the first or the next record within a set. C/SIDE then handles subsequent reads with no additional effort, and fewer calls to the server give better performance. In addition set when you browse.<br /><br />Microsoft Dynamics NAV with Microsoft SQL Server only supports the default values for the parameters of the LOCKTABLE function – LOCKTABLE(TRUE,FALSE).</p><p><strong><u>Locking in Classic Database Server</u></strong><br /><br />Data that is not locked is read from the same snapshot (version) of the database. If you call a modifying function (for example, INSERT, MODIFY, or DELETE), on a table, the whole table is locked.<br /></p><p><strong>Locking Record Sets</strong><br /><br />Usually you lock a table before reading a set of records in that table if you want to read these records again and modify or delete them. With Classic Database Server, you can choose to lock the table with LOCKTABLE(TRUE,TRUE) after reading the records for the first time instead of locking with LOCKTABLE before reading the records for the first time.<br /><br />When you try to modify or delete the records, you receive an error message if another transaction has modified the records.<br /><br />You also receive an error message if another transaction has inserted a record into the record set. However, if another transaction has deleted a record from the record set, you will not notice this change. The purpose of locking with LOCKTABLE(TRUE,TRUE) after reading the records for the first time is to improve concurrency by postponing the table lock that Classic Database Server puts on the table.<br /></p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com1tag:blogger.com,1999:blog-260052111146582180.post-81484094323146541992009-07-15T15:33:00.000+05:302009-07-15T15:37:37.337+05:30LOCKTABLE FunctionOrdinarily, when you are developing applications in C/SIDE, you do not need to take into consideration transactions and table locking. There are, however, some situations in which you must lock a table explicitly. To do this, use the LOCKTABLE function.<br /><br />For example, in the beginning of a function, you inspect data in a table and then use this data to perform various checks and calculations. Finally, you want to insert a record based on the result of these calculations. To ensure that your calculations make sense, you must be certain that the values you retrieved at the beginning of the transaction are consistent with the data that is in the table now. You cannot allow other users to update the table while your function is performing its calculations.<br />LOCKTABLE Function<br /><br />You can use the LOCKTABLE function to lock the table at the start of your function.<br /><br />LOCKTABLE has the following syntax.<br /><strong>Record.LOCKTABLE([Wait] [, VersionCheck])</strong>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-57339049317911385622009-07-15T15:17:00.003+05:302009-07-25T12:59:50.058+05:30GET, FIND, and NEXT Functions<p><strong><u>GET, FIND, and NEXT Functions</u></strong></p><p><strong>The following functions are used to search for records:</strong></p><p><strong> . GET<br /><br /> . FIND<br /><br /> . NEXT</strong></p><p>These functions are some of the most commonly used C/AL functions. When you search for records, it is important to know the difference between GET and FIND and to know how to use FIND and NEXT in conjunction.<br /></p><p><strong><u>GET Function</u></strong><br /><br />GET retrieves one record based on values of the primary key fields.<br /><br />GET has the following syntax.<br /><strong>[Ok :=] Record.GET([Value],...)</strong><br /><br />For example, if the No. field is the primary key of the Customer table and if you have created a Record variable called CustomerRec that has a Subtype of Customer, then you can use GET in the following way:<br />CustomerRec.GET('4711');<br /><br />The result is that the record of customer 4711 is retrieved. <br /><br />GET produces a runtime error if it fails and the return value is not checked by the code. In the preceding example, the actual code that you write should be similar to the following.<br />IF CustomerRec.GET('4711') THEN<br />.... // Do some processing.<br />ELSE<br />.... // Do some error processing.<br /><br />GET searches for the records, regardless of the current filters, and it does not change any filters. GET always searches through all the records in a table.</p><p><br /><strong><u>FIND Function</u></strong><br /><br />FIND locates a record in a C/SIDE table based on the values stored in the keys.<br /><br />FIND has the following syntax.<br /><strong>Ok := Record.FIND([Which])</strong><br /><br />The important differences between GET and FIND are the following:<br /><br /> FIND uses the current filters.<br /><br /> FIND can be instructed to look for records where the key value is equal to, greater than, or smaller than the search string.<br /><br /> FIND can find the first or the last record, depending on the sort order defined by the current key.<br /><br />When you are developing applications in a relational database, there are often one-to-many relationships defined between tables. An example could be the relationship between an Item table, which registers items, and a Sales Line table, which registers the detailed lines from sales orders. One record in the Sales Line table can only be related to one item, but each item can be related to any number of sales line records. You would not want an item record to be deleted as long as there are still open sales orders that include the item. You can use FIND to check for open sales orders.<br /><br />The <strong>OnDelete</strong> trigger of the Item table includes the following code that illustrates using FIND.<br />SalesOrderLine.SETCURRENTKEY(Type,"No.");<br />SalesOrderLine.SETRANGE(Type,SalesOrderLine.Type::Item);<br />SalesOrderLine.SETRANGE("No.","No.");<br />IF SalesOrderLine.FIND('-') THEN<br />ERROR(Text001,TABLECAPTION,"No.",SalesOrderLine."Document Type");</p><p><br /><strong><u>NEXT Function</u></strong><br /><br />NEXT is often used with FIND to step through the records of a table.<br /><br />NEXT has the following syntax.<br /><strong>Steps := Record.NEXT([Steps])</strong><br /><br />In the following example, FIND is used to go to the first record of the table. NEXT is used to step through every record, until there are no more. When there are no more records, NEXT returns 0 (zero).<br />FIND('-');<br />REPEAT<br />// process record<br />UNTIL NEXT = 0;</p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-40426995219161903952009-07-15T15:03:00.004+05:302009-07-15T15:22:27.353+05:30Essential C/AL Functions<p align="justify">Although there are more than 100 functions in C/AL, there are several functions that you will use more often than the others.</p><p align="justify">1. GET, FIND, and NEXT Functions<strong><br /></strong></p><p align="justify">2. SETCURRENTKEY, SETRANGE, SETFILTER, GETRANGEMIN, and GETRANGEMAX Functions</p><p align="justify"><br />3. INSERT, MODIFY, MODIFYALL, DELETE and DELETEALL Functions<br /></p><p align="justify">4. LOCKTABLE Function<br /></p><p align="justify">5. CALCFIELDS, CALCSUMS,FIELDERROR, FIELDNAME, INIT, TESTFIELD, and VALIDATE Functions<br /></p><p align="justify">6. Progress Windows, MESSAGE, ERROR and CONFIRM Functions<br /></p><p align="justify">7. STRMENU Function<br /><br /></p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0tag:blogger.com,1999:blog-260052111146582180.post-34784878405192098392009-07-15T14:56:00.001+05:302009-07-15T14:59:29.879+05:30Guidelines for Placing C/AL CodeThe following are simple guidelines for placing C/AL code:<br /><br />In general, place the code as close as possible to the object on which it will operate. This implies that code which modifies records in the database should normally be placed in the triggers of the table fields that are involved.<br /><br />In reports, always maintain a clear distinction between logical and visual processing and position your C/AL code accordingly. This implies that it is acceptable to have C/AL code in a section trigger if that code controls either the visual appearance of the controls or whether the section should be printed. Never place code that manipulates data in section triggers.<br /><br />The principle of placing code near the object on which it operates can be overruled in some situations. One reason to overrule this principle is security. Normal users do not have direct access to tables that contain sensitive data, such as the General Ledger Entry table. If you place the code that operates on the general ledger in a codeunit, give the codeunit access to the table, and give the user permission to execute the codeunit, you will not compromise the security of the table and the user will be able to access the table.<br /><br /><p>There are reasons other than security for putting a posting function in a codeunit. A function that is placed in a codeunit can be called from many places in the application, including, perhaps, some that you did not anticipate when you first designed the application.</p><p><strong><u>Reusing Code</u></strong><br /><br />The most important reason for placing C/AL code consistently, and as close to the objects that it manipulates, is that it lets you reuse code. Reusing code makes developing applications both faster and easier. More importantly, if you place your C/AL code as suggested, your applications will be less prone to errors. By centralizing the code, you will not inadvertently create inconsistencies by performing essentially the same calculation in many places<br /><br /></p><p><br /></p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com1tag:blogger.com,1999:blog-260052111146582180.post-14998873867499003312009-07-15T14:49:00.003+05:302009-07-15T14:55:53.603+05:30Where to Write C/AL Code<p>This section describes where to write C/AL code. Almost every object in C/SIDE contains triggers where you can place your C/AL code. Triggers exist for the following objects:</p><p>The main Objects in Navision are</p><p>1. Tables<br /><br />2. Table fields<br /><br />3. Forms, including request forms<br /><br />4. Form controls<br /><br />5. Reports<br /><br />6. Data items<br /><br />7. Sections<br /><br />8. Pages<br /><br />You can initiate the execution of your C/AL code from the following:<br /><br /> #. Command buttons<br /><br /> #. Menu items<br /><br /> #. Codeunits.<br /><br /></p>Rahul Udayakumarhttp://www.blogger.com/profile/00955572511711846329noreply@blogger.com0