nav manual

Upload: mahadev-subramani

Post on 04-Jun-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Nav Manual

    1/24

    Programming with C / AL for Microsoft Business Solutions Navision - Presentation Transcript

    Programming Language C / LA for Microsoft Business Solutions Navision Pablo Espada Well www.esbupa.com

    www.programadorautonomo.net Note: Microsoft, Navision, C / AL, etc ... are trademarks of Microsoft

    1.

    2. I usually devote to training and development work and consulting. NET

    Also impart training on Navision Development

    If you want to work with you giving them training or developing a project, please contact:

    Web

    www.programadorautonomo.net

    www.esbupa.com

    Email

    [Email_address]

    [Email_address]

    Hope you like the presentation

    Contact

    Language C / AL - Index3.

    Data Types

    Variables

    Features

    Operators

    Judgments

    Allocation

    Decision (IF, CASE)

    Iteration (FOR, REPEAT, WHILE)

    Other

    Comments

    Tables

    Object Access

    Forms

    Information

    Source Units

    Dataports

    Common Functions

    SumIndexFields

    Flowfields

    Dialogues

    File Access

    Scrubber

    Tracking Code

    Code Wizard

    OCX

    BLOB

    Standard Format

    Introduction4.

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    2/24

    4GL language environment to work in Navision

    Specialized work on relational DB

    Integrated in Windows environment

    OCX to access data from other applications

    File Access

    Data Types5.

    Key variables: Numeric

    Integer

    Numbers between 2147483647 and +2,147,483,647.

    BigInteger

    64-bit number.

    L is used to indicate that is a long integer: bi: = 3983200032984209L.

    Decimal

    Numbers and +10 E63-10E63.

    18 significant digits.

    Char

    A character between 0 and 255, freely convertible to whole character.Operable as an integer or a character:

    C: = 'A';

    C: = S [2];

    C: = C + 1;

    Option

    Option number between 2147483647 and +2,147,483,647, freely convertible at the option entirely.The options are the property symbolically declare the variable OptionString: OptionString = Offer,

    Order, Invoice, Payment

    Data Types (II)6.

    Key variables: String

    Text

    Chains of up to 250 characters.

    Their characters are indexed:

    Name [3]

    Code

    Strings of up to 250 characters.

    Capitalized.

    The system automatically does the conversion, and removes leading and trailing spaces. His

    characters are indexed:

    CodFormasPago [3]

    Data Types (III)7.

    Key variables: Date and Time

    Date

    Stores a date.

    0D is initialized.

    today: = 220704D;

    Time

    Store an hour

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    3/24

    0T is initialized with

    Time: = 123000T;

    DateTime

    Stores a UTC time.Always adapted to local time display

    0T is initialized with

    DateTime: = December 31, 2004, 14:20:59.999.;

    Data Types (and IV)8.

    Key variables: Boolean

    Boolean

    Logical values: TRUE or FALSE

    Complex Types9.

    C / AL includes a set of complex types used in certain cases

    BLOB

    Used to store binary (images, files, videos, etc. ..) and is stored outside the record of the

    database.2GB Max Size

    Record

    A record is associated with a record of each table.

    Access to fields is done by writing the name of the record, a point and the field name:

    EJ: Customer. "No."

    Complex Types (II)10.

    Form

    It represents a form.Each form is composed of a set of controls

    Report

    Represents a Report

    Codeunit

    Container code, organized in functions

    File

    File Type. It gives access to a file system file

    Complex Types (III)11.Dialog

    Represents a dialog box.

    DateFormula

    Represents a formula for the function CALCDATE

    GUID

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    4/24

    Unique Identifier of the system.16 bytes:

    12345678-1234-1234-1234-1234567890AB

    TableFilter

    Lets you apply a filter to a table.Only used for Permits

    Complex Types (IV)12.

    RecordRef

    Pointer to a registry.It differs from the type Record that, a priori, know the table that will write.

    The fields are equivalent FieldRef

    The key is the equivalent keyref

    RecordID

    Stores the ID of the table with Primary Key.

    InStream and OutStream

    Can read and write BLOB's

    Variant

    Undefined type required for the use of OCX

    Contains: record, file, action, codeunit, Automation, boolean, option, integer, decimal, char, text,

    code, date, time, binary, DateFormula, TransactionType, InStream and OutStream.

    BigText

    Similar to the BLOB but only for text content.MAX 2GB

    Variables13.

    Initialization

    C / AL variables initialized to default values:

    Boolean: FALSE

    Numeric: 0

    Strings:''

    Date: 0D

    Time: 0T

    Variables (II)14.

    Definition

    Variables in C / AL can be:

    Local: Its scope is the function which defines

    Global: Its scope is the object which defines

    Variables (III)15.

    Example:

    We will create a new CodeUnit

    Define a set of variables (local and global)

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    5/24

    Option can create a variable and display their values as follows:

    MESSAGE ('The value of% 1 is% 2', 'LoopNo' LoopNo)

    Variables (IV)16.

    Arrays and matrices

    Property is defined Dimensions variable

    Dimensions = 4, 3

    Brackets is the reference

    SaldoCtaBanco [2,2]

    indices have range 1 ... n

    Features:

    CLEAR (Clear all Array)

    Arrayl (Returns the length of the array)

    System Variables17.

    System variables (system-defined variables)

    C / SIDE creates and makes available to the programmer in certain contexts

    Rec

    When you edit a record, Rec contains the record in its modified state.

    xRec

    When you edit a record, xRec contains the record before the amendment.

    CurrForm

    Variable that represents the current Form object.

    CurrReport

    Variable that represents the current Report.

    RequestOptionsFormVariable that represents the input dialog form object Current Report.

    CurrFieldNo

    The field number of the current field from what was called the trigger.

    Features18.

    Definition

    The function is defined with a name, a number of optional parameters and optional return value.They

    can have local variables.

    The parameters can be by reference (amending its value, eg "value") or by value (the value is not

    altered, eg: "flag")

    Can be called from other objectsOperators19.

    Operator C / AL Meaning

    .camp registration form or report control

    () Parentheses

    [] Indexing

    :: Scope

    + Sum

    - Subtract

    * Multiply

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    6/24

    / Division

    DIV integer division

    MOD rest

    > Greater than

    > = Greater than or equal to

    = Value2) AND (Value1

  • 8/13/2019 Nav Manual

    7/24

    [] Indicates optionality in that part of the sentence.

    A statement block contains a set of statements between BEGIN and END;

    Begin

    ..

    End;

    A returns a value.

    A assigns the value expression result to a variable.The field name, if it contains spaces or special characters, is written in "quotes"

    Sentences (I)24.

    Allocation

    Assignment Operator

    today: = 220704D;

    value: = 4;

    As a result of function call

    Return value of a function

    Function square (value: Integer) Quad: Integer

    Beginsq: = value * value

    End;

    value: = Square (3), / / value is equal to 9

    Passing parameters by reference to a function

    Cube Function (VAR value: Integer)

    Begin

    value: = value * value * value

    End;

    value: = 2;

    Cube (value) / / value is equal to 8

    Chain Operator25.

    The symbol '+' is used to concatenate strings

    What happens if we make an allocation of a string with the concatenation of two others, and this

    result is larger than the chain?

    There is a runtime error

    We can solve the overflow by checking first:

    MAXSTRLEN you return the maximum string size

    COPYSTR lets you copy n characters from a string to another.Use F5 (Symbol menu) to help

    Sentences (II)26.

    Decision

    IF

    Evaluate the condition, if true execution of the IF statement block, otherwise the ELSE Part.

    IF THEN

    [ELSE

    ]

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    8/24

    Example

    IF (Quantity = 0) AND ("Invoiced Amount" 0) THEN

    Testfield (Order No. mov. Asoc product. ")

    ELSE BEGIN

    IF Quantity "Invoiced Amount" THEN

    Testfield ("Invoiced Amount", 0);

    Testfield (Order No. mov. Asoc product. ", 0);

    END;

    Examples27.Modify the above form as follows:

    Variables Definition Execute Execute OnPush Clear

    Examples28.

    Add what is necessary to calculate the average units sold / bought

    Accountants of times you buy / sell

    Total Sales / Shopping

    Examples29.

    On the example above, add the TextBox a list of 10 and 10 decimal Array

    We must make every time you click the Run button, the result is displayed in a different position from

    Array

    Sentences (II I)30.

    Decision

    CASE

    Evaluates the expression and executes the statement block of corresponding value. If there is an equal

    value, execute the judgments of the ELSE block.

    CASE OF

    : ;

    ...

    :

    [ELSE ]

    END;

    Example

    CASE "Type amount" OF

    Type "value":: Balance: ValorCol: = CGCta. "Pptdo amount."

    Type "amount":: Please:

    BEGIN

    ValorCol: = CGCta. "Should be budgeted"

    Do: = TRUE;

    END

    ValorCol ELSE: = CGCta. "To have budgeted"

    END;

    Sentences (IV)31.

    Iteration

    FOR

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    9/24

    Repeats a set of statements until the result of the assignment expression reaches the value

    indicated

    FOR TO / DO DOWNTO

    Example

    FOR j: = Tasks DOWNTO 1 DO BEGIN

    Inclination [j]: = Inclination [j - 1];

    Constant [j]: = Constant [j - 1];MaxValImport [j]: = MaxValImport [j - 1];

    END;

    Sentences (V)32.

    Iteration

    REPEAT ..UNTIL

    Repeats a set of statements until the expression evaluates to TRUE.

    REPEAT

    UNTIL

    Example

    ('-') THEN IF CGCta.FIND

    REPEAT

    Result: = Result + CalcCGCta (CGCta, ColumEsqCta)

    Num: = Num + 1;

    UNTIL CGCta.NEXT = 0;

    Sentences (VI)33.

    Iteration

    WHILE ..DO

    Repeat the set of statements until the next END if the expression evaluates to TRUE

    DO WHILE

    [END;]

    Example

    LinComentVenta.SETRANGE ("Document Type", "document type");

    LinComentVenta.SETRANGE ("No." "No.");

    ('-') DO BEGIN WHILE LinComentVenta.FINDLinComentVenta.DELETE;

    LinComentVenta. "Document Type": = CabVta. "Document Type";

    LinComentVenta. "No.": = CabVta. "No."

    LinComentVenta.INSERT;

    END;

    Sentences (and VII)34.

    Other

    http://translate.googleusercontent.com/tr

    4 03-08-10

  • 8/13/2019 Nav Manual

    10/24

    WITH

    The statements inside the WITH refer to the registration form, etc.

    Clie DO BEGIN WITH

    "No.": = '1 ';

    Name: = 'Pepe';

    Address: = 'Rue the Barnacle, n 13';

    City: = "Niu wept ';

    END;

    EXIT

    Leave a segment of code or function (you can return the value)

    Absolute FUNCTION (value: Integer) ret: Integer

    BEGIN

    IF (value

  • 8/13/2019 Nav Manual

    11/24

    Triggers table:

    OnInsert.It runs when you insert a record into the table.

    OnModify.It runs the modiicar a field in a table row.

    OnDelete.It runs to delete a table row.

    OnRename.It runs when editing a field that is part of the primary key of a table row.

    Releases of fields in the table:

    OnValidate.It runs to change the value of a field.

    OnLookup.It runs when you press F6 on the field to find a value.

    Functions defined in a tableYou can define functions in the table and call them from the object itself or from other objects.

    Tables (II)41.

    To access the variables defined tables Record type

    Modifying fields in the table:

    By assigning values.

    Clie: Record (Client) / / Variable type Clie record / / customer table

    Clie. "No.": = '10 ';

    Clie. "Name": = 'Pepe';

    With the ruling Validate, assigns the value and executes the trigger OnValidate each field assignedto the Customer table.

    Clie: Record (Client);

    Clie.VALIDATE ("No.", '10 ');

    Clie.VALIDATE (Name, 'Pepe');

    Tables (II I)42.

    Working with records from the table:

    Initialization. Is set each field in the record to its default value depending on its type.

    Clie: Record (Client);

    Clie.INIT;Insertion of records in the table.With the INSERT statement and a parameter that indicates

    whether the trigger executes OnInsert of the table or not.

    Clie.VALIDATE ("No.", '10 ');

    Clie.VALIDATE (Name, 'Pepe');

    ...

    Clie.INSERT (TRUE);

    Amendment of records in the table.Judgement MODIFY with a parameter that indicates whether

    the trigger executes OnModify of the table.

    Clie.VALIDATE (Name, 'Luis');

    Clie.MODIFY (TRUE);

    Tables (IV)43.

    Working with records from the table:

    Deleting records in the table.By DELETE statement and a parameter that indicates whether the

    trigger executes OnDelete of the table or not.

    Clie.DELETE (TRUE);

    Changing fields of records in the table as part of the primary key. Judgement RENAME with a

    parameter that indicates whether the trigger executes OnRename of the table.

    Clie.VALIDATE ("No.", '21 ');

    Clie.RENAME (TRUE);

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    12/24

    Tables (V)44.

    Finding records in a table:

    Get a record from a table by its primary key.

    Job.GET (N ."); Job

    Job.TESTFIELD (Blocked, FALSE);

    In previous statements we obtain a Job table row (Case GET) and found that one of the fields in

    the record has the value indicated (testfield)

    Get one or more record in a table for secondary keys.

    Clie.RESET;

    Clie.SETCURRENTKEY (Name, Address, City);

    Clie.SETRANGE (Name, 'Luis');

    Clie.SETFILTER (City, '% 1 |% 2', 'Paris', 'Rome');

    First act on the Clie variable filters and removing all previous ranges (RESET).Activate a key bywhich we will seek (SETCURRENTKEY) for setting search ranges and registration is based on thekey indices to be more effective. Filters are set with two functions: SetFilter SetRange andbasically the same but SetFilter allows for more complex conditions. It is advisable to set filters on

    fields in the order they appear on the primary key.Clie currently contains all records that meet the

    conditions of the filters.

    45. Tables (VI)46.Finding records in a table:

    Traverse table records

    ('-') THEN IF Clie.FIND

    REPEAT

    registro> 0 finds the next record skipping the indicated number

  • 8/13/2019 Nav Manual

    13/24

    IF ListaClientes.RUNMODAL = ACTION:: LookupOK THEN BEGIN

    ListaClientes.GETRECORD (Clie)

    cliente.validate (Clie. "No.");

    CLEAR (ListaClientes)

    END;

    Suitable filters are set in the variable type Clie Client Record.

    ListaClientes is of type Form.

    SETTABLEVIEW set the form view and set the client ListaClientes asset by SETRECORD.

    LOOKUPMODE serve causes the form to retrieve data.GetRecord get the record marked.

    CLEAR removes the form.

    Object Access48.

    Form:

    Shortcut:

    ('-'); CGMov.FIND

    FORM.RUN (FORM:: "Movs. Accounting," CGMov)

    IF FORM.RUNMODAL (216 LinPptoProy) = ACTION:: LookupOK THEN BEGIN

    "Cod. Phase": = LinPptoProy. "Cod.phase ";"Cod. Subphase": = LinPptoProy. "Cod.subphase "

    "Cod. Task": = LinPptoProy. "Cod.task ";

    END;

    Variable access:

    ListCtaCG: Form "Accounts List"

    ListCtaCG.LOOKUPMODE (TRUE);

    IF ListCtaCG. RUNMODAL = ACTION:: LookupOK THEN ...

    FormNavegar: Form "Browse"

    FormNavegar.DefDoc ("Registration Date", "No.");

    FormNavegar. RUN;

    Access Objects (II)49.

    Report:

    Shortcut:

    Clie.SETRECFILTER / / put a filter (in the primary key) / / for the Report to run only on the / / Current

    Customer

    REPORT. RUN (REPORT:: "Inf-example" ReqForm, FALSE, Clie)

    REPORT. RUNMODAL (REPORT:: "Inf-example", FALSE, Printer, Clie)

    Variable access:

    r: Report Supplier - Lines orders ";

    Clear (r);

    Prov.SETRECFILTER;

    r.SETTABLEVIEW (Prov)

    r.RUNMODAL;

    ...

    r.RUN;

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    14/24

    Access to Objects (and III)50.

    Codeunit:

    It performs the function of the Codeunit RUN

    Shortcut:

    IF CODEUNIT. RUN (22, LinDiaProd) THEN

    ...

    Variable access:DiaGenTestLin: Codeunit "Dia.Test Gen-line ";

    DiaGenTestLin. RUN (LinDiaGen)

    / / LinDiaGen may have changed (VAR)

    Forms51.

    Where enter code

    Form Releases:

    OnAfterGetRecord.It runs the recurperar a record of the table, but before displaying the

    registration form.

    Triggers form controls.Buttons on the form:

    Command Button

    Menu Button: In each of the Menu Items

    Functions defined in a form:

    You can define functions in the form and call them from the object itself or from other objects.

    In any case, the code must be written in the table if possible!

    Forms (II)52.

    After retrieving a record from the table, but before it is displayed in the form OnAfterGetRecord

    trigger execution.

    Ex: Before showing the registration, apply a filter and calculates the value of a SumIndexField

    showing on the form.

    Forms (and III)53.

    Clicking on a button or a menu option in a dropdown button runs the trigger OnPush.

    Example: We can invoke a function in a one-parameter Codeunit.

    Information54.

    Where enter code

    Releases of the report:

    OnPreReport.Is processed before running the report.

    Releases of each DataItem:

    OnPreDataItem. It runs before the DataItem is processed.

    OnAfterGetRecord. It runs every time you get a record.

    OnPostDataItem. Is executed after the processing of DataItem.

    Report Request Form.

    Functions defined in a report.

    Sections of the form:

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    15/24

    OnPreSection. It runs before a section is processed.

    OnPostSection. It runs after a section is processed.

    Reports (II),55.

    Before the execution of a trigger Report OnPreReport runs.

    Example: We can use the filters for which the Report has been called, and then print them in a

    section Header (FiltClient and FiltMovProducto).

    Reporting (II I)56.

    Before the implementation of a DataItem OnPreDataItem fires.

    Example: We can use it to maintain a field total for a section with the function CREATETOTALS

    FOOTER.You can also set a record for page NEWPAGEPERRECORD function, if we chose the

    option in the Request Form.

    After obtaining a record of running OnAfterGetRecord DataItem.

    Example: We can make calculations for a value that is printed (Bf gross).You can also call

    NewPage from this trigger to change the page.

    With CurrReport.SKIP can skip the iteration of the DataItem.

    Reports (and IV)57.

    Before showing a section OnPreSection runs.

    Example: We want to show the section or not (SHOWOUTPUT function), or perform computations

    for a value printing.

    Code Units58.

    Where enter code

    OnRun function:

    Is created by default with a new codeunit.

    It is the entry point for execution by default.

    You can have a record as parameter.

    Codeunit Functions:

    If you create a function in a Codeunit can be invoked from other objects:

    DiaGenTestLin: Codeunit "Dia.Test Gen-line ";

    DiaGenTestLin. Tester (LinDiaGen)

    Dataports59.

    Where enter code

    DataPort Triggers

    OnPreDataport.Before the implementation of the Dataport.

    OnPostDataport. After the execution of the Dataport.

    DataItem Triggers

    OnPreDataItem (). Before processing the DataItem.

    OnBeforeExportRecord (). Before you export a record.

    OnAfterExportRecord (). After you export a record.

    OnBeforeImportRecord (). Before importing a record.

    OnAfterImportRecord (). After importing a record.

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    16/24

    OnPostDataItem (). After processing a DataItem.

    The Dataport Request form

    Features Dataport

    Dataports (II)60.

    A Dataport can import data and add them to a table.

    Example: Add records to a newspaper.Need before starting to learn that "No line will have the firstregistration of imported

    Dataports (III)61.

    Before processing a DataItem.

    Example: A Dataport function is called before invoking the Dataport, then run the Dataport and set

    a filter on a field of the DataItem. FiltroNoCampaa variable does not lose its value between the

    two calls is not running CLEAR.

    Dataports (and IV)62.

    After importing the registry, and before inserting into the table.

    Example: Seeking a new line number and fill the description field.

    Common Functions63.

    Other commonly used functions:

    RESET

    Delete key selection filters and a variable Record

    DesdeLMComp.RESET;

    DesdeLMComp.SETRANGE (LM No. "" No product ");DesdeLMComp.SETRANGE (Type, DesdeLMComp.Tipo:: Product)

    ('-'); DesdeLMComp.FIND

    NoSigLin: = "Line No."

    COUNT

    Count the number of records.

    DesdeLMComp.SETRANGE (LM No. "" No product ");

    DesdeLMComp.SETRANGE (Type, DesdeLMComp.Tipo:: Product)

    NoCompoLM: = DesdeLMComp.COUNT;

    Common Functions (II)64.

    COPY

    Copy a Record variable in another of the same table, active filters and keys.

    NuevoClie: = COPY (Clie)

    TRANSFERFIELDS

    Copy the contents of the fields in a record variable to another that does not have to be of

    the same table.It takes into account the number of campo.Los fields that do not have

    matching numbers are set to their default values.

    RegHasta: = TRANSFERFIELDS (RegDesde)

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    17/24

    Common Features (III)65.

    EVALUATE

    Convert a value from one type to another.

    Value: = '010196 ', / / type string

    Ok: = EVALUATE (VarInteger, Value); / / Integer = 10 196

    Ok: = EVALUATE (VarDate, Value) / / Date = 010196D

    FORMAT

    Convert a value into a string

    MESSAGE ('Today is% 1', FORMAT (TODAY));

    Common functions (IV)66.

    Deleteall

    Delete a series of records in a table

    LinExtCtaBanco.SETRANGE ("N bank", "N bank");LinExtCtaBanco.SETRANGE ("No abstract", "No Abstract");

    LinExtCtaBanco.DELETEALL;

    MODIFYALL

    Modify a number of records in a table

    CGMov.RESET;

    CGMov.SETCURRENTKEY ("Account No.");

    CGMov.SETRANGE ("Account No." CGCta. "No.");

    CGMov.MODIFYALL ("Account No. ",'');

    Common functions (V)67.

    COPYFILTER [S]

    Copy the filters of a type variable to another record in the same table (copy COPYFILTER

    filters only one field)

    Clie1.SETFILTER ("No.", '

  • 8/13/2019 Nav Manual

    18/24

    Gets the name of a field

    SumIndexFields69.

    [Ok: =] Record.CALCSUMS (Field1, [Field2] ,...)

    Returns the sum for one (or more) SumIndexField.

    Must be on a key that has defined the field.

    There should be filters in fields outside the key.

    If the above conditions are met, it returns FALSE (or throws an error message).

    MovCli.SETCURRENTKEY ("Customer No.", "record date");MovCli.SETRANGE ("Customer No.", "AAA 1050");

    MovCli.SETRANGE ("Registration Date", 010199D, 123102D)

    MovCli.CALCSUMS (Import)

    FlowFields70.

    [Ok: =] Record.CALCFIELDS (Field1, [Field2] ,...)

    The table fields are FlowFields must be recalculated by applying filters.

    Cliente.SETRANGE ("Filter dates, 010199D, 123102D)

    Cliente.CALCFIELDS (Balance, "Balance Period");

    Dialogues71.

    Posts:

    Asynchronous Message

    MESSAGE

    MESSAGE ('Message asynchronous information');

    ERROR. Causes Rollback.

    ERROR ("ERROR: This runs RollBack ');

    .FIELDERROR. Displays the Wrong Field

    Message + Ok / Cancel

    CONFIRM

    IF CONFIRM ('want to continue') THEN

    Code> to SI>

    ELSECode> to NO>

    Dialogues (II)72.

    Posts:

    Menu options

    STRMENU

    STRMENU CASE ('& Insert & Modify, & Delete, & Finish', 4) OF

    1: code> to Insertar>

    2: code> to Modificar>

    3: code> to Borrar>4: code> to Terminar>

    Code> for Cancelar> ELSE

    END;

    Dialogues (and III)73.

    Posts:

    Dialog type objects

    Ventana.OPEN ('# 1 ############################ \' +

    'Customer # 2 ############### \' +

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    19/24

    'New Name # 3 ############### \' +

    '@ 4@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');

    Num: = 0;

    Ventana.UPDATE (1, 'Client Table');

    Clie.RESET;

    ('-') THEN IF Clie.FIND

    REPEAT

    Num: = Num + 1;Ventana.UPDATE (2 Clie.Nombre)

    Ventana.INPUT (3, newName);

    Ventana.UPDATE (4, ROUND ((Num / Clie.COUNT) * 10000));

    Clie.VALIDATE ("Name", newName);

    UNTIL Clie.NEXT = 0;

    Ventana.CLOSE;

    File Access74.

    Writing to a file:

    NombArch =''THEN IFERROR ('Enter the file name. ")

    CLEAR (FicMovCont)

    FicMovCont.TEXTMODE: = TRUE;

    FicMovCont.WRITEMODE: = TRUE;

    FicMovCont.QUERYREPLACE: = TRUE;

    FicMovCont.CREATE (NombArch)

    FicMovCont.WRITE (

    STRSUBSTNO (

    '# 1 #################### # 2 ####### # 3 ####### # 4 #',

    COMPANYNAME, FechInicConsol, FechFinConsol, FORMAT (TransfPorDia, 0,2)));

    FicMovCont.CLOSE;

    File Access (II)75.

    Read from a file:

    NombArch =''THEN IF

    ERROR ('Enter the file name. ")

    CLEAR (FicMovCont)

    FicMovCont.TEXTMODE: = TRUE;

    FicMovCont.OPEN (NombArch)

    WHILE FicMovCont.POS FicMovCont.LEN DO BEGIN

    FicMovCont.READ (LinTexto)CodEmpr. "Name": = DELCHR (COPYSTR (LinTexto, 1.30 ),'>');

    EVALUATE (FechInicConsol, COPYSTR (LinTexto, 32.9));

    EVALUATE (FechFinConsol, COPYSTR (LinTexto, 42.9));

    EVALUATE (TransfPorDia, COPYSTR (LinTexto, 52.3));

    END;

    FicMovCont.CLOSE;

    Global Constants System76.

    USERID.ID of the user who logged

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    20/24

    Str: = USERID;

    COMPANYNAME.Returns the current company

    Str: = COMPANYNAME;

    OSVersion. Returns a string indicating the current operating system

    Str: = OSVersion;

    WORKDATE.Returns the current working date

    TFecha: = WORKDATE;

    TODAY.Returns the date of the operating system

    Date: = TODAY;TIME. Returns the operating system time

    Time: = TIME;

    String Functions77.

    Strpos

    Position of one string within another

    COPYSTR

    Copy a string to another

    Strlen

    Size of a String

    PADSTR

    Add characters to a String

    MAXSTRLEN

    Maximum size of a string

    LOWERCASE / UPPERCASE

    Converting to Uppercase / Lowercase

    String Functions (II)78.

    CONVERTSTR

    Replaces a character set other, within a string

    DELCHR

    Deletes a set of characters within a string

    INCSTR

    Increases a string numerically

    SELECTSTR

    Returns a substring within a set of strings separated by commas

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    21/24

    STRCHECKSUM

    Calculates a checksum for a string of numbers

    Date Functions79.

    DATE2DMY

    Gets Day, Month or Year from a Date

    DATE2DWY

    Gets Day, Week or Year from a Date

    CALCDATE

    Calculates a date based on a start date and a DateFormula

    Date Functions (II)80.

    NORMALDATE

    Converts a date to "Normal Date"

    CLOSINGDATE

    Converts a Date "Closing Date"

    Math Functions81.

    ABS

    Absolute Value

    POWER

    Power

    ROUND

    Rounding

    RANDOMIZE

    Plant a seed for the random number generator

    RANDOM

    Gets a random number

    Array Functions82.

    Arrayl

    Returns the number of array elements

    COMPRESSARRAY

    Eliminates white elements of an array of text

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    22/24

  • 8/13/2019 Nav Manual

    23/24

    ELSE

    x: = b / (a + b);

    WRONG IF (a> b) THEN

    a: = 0;

    Standard Format (II)90.

    Do not use parentheses in function calls without parameters.

    WELL RegistrarLnea;

    MAL RegistrarLnea ();

    IF and THEN go on the same line. ELSE is on a separate line.

    WELL IF x = y THEN

    x: = x + 1

    ELSE

    x: =-x - 1;

    Standard Format (II I)91.

    The additional clauses including an EXIT ELSE should have no part.

    WELL IF x y THEN

    EXIT (FALSE);

    x: = x * 2;

    MAL IF x y THEN

    EXIT(FALSE)

    ELSE

    x := x * 2;

    Cuando BEGIN sigue a THEN o ELSE , va en su misma lnea

    BIEN IF x = y THEN BEGIN

    x := x * 2;

    a := a - 3;

    END;

    MAL IF x = y THEN

    BEGIN

    x := x * 2;

    a := a - 3;END;

    Formateo estndar (y IV)92.

    Expresar las opciones de campos o variables de forma explcita.

    BIEN IF Tipo = Tipo::Oferta THEN

    MAL IF Tipo = 0 THEN

    REPEAT debe ir solo en su lnea y UNTIL debe ir en una lnea acompaado slo de la condicin

    http://translate.googleusercontent.com/tr

    24 03-08-10

  • 8/13/2019 Nav Manual

    24/24

    de fin.

    BIEN IF x < y THEN BEGIN

    REPEAT

    x := x + 1;

    UNTIL x = y;

    b := x;

    END;

    WHILE y DO van en la misma lnea.

    BIEN WHILE z < a DO BEGIN

    a := a + 1;

    b := b - 1;

    END;

    http://translate.googleusercontent.com/tr