User:anonymousLog inRegister
Recents:
Serial Rule

Scope

Objects: Transactions
Languages: .NET, Cobol, Ruby, Java, RPG, Visual Basic, Visual FoxPro

Purpose

Used for recording serial numbering.

Syntax

Serial(att1 , att2 , step);

Where:
att1
Is the attribute to be increased.

att2
Is the attribute with starting value for att1

step
Is the value to add to att1

Description

The purpose of this rule is to automatically increase the value of att1 by the value given in the step parameter whenever a new record is added to the table which has att1. att2 marks the starting value for att1, and is always updated to show the last value of att1. att2 must be in a table directly superordinated to the table containing att1.
 
Notes:

  • If att1 is NOT part of the Transaction level Identifier, the resulting code works like the DEFAULT rule. If att1 is part of the Transaction Identifier, the user has to key-in a non-existing value for att1 to switch to INSERT mode and assure that att1 gets the next value.
  • In the field-to-field dialog (where the mode is automatically inferred), a non-existing value should be keyed in for att1 (usually 0). The program will then assign the proper value. In the full-screen dialog, the value is assigned when the user presses <Enter> while in the Insert mode.

    Example

    This rule is useful for automatically assigning values to an identifier within the Transaction. For example, in the Orders Transaction we have PoLineNbr and if we want this number to be automatically assigned by the system, the rule can be used as follows:

    Orders Transaction structure:

    PoNbr*       // Purchase Order Number
    ....
    PoLstLineAsg // Purchase Order Last Line Number
    (PoLineNbr*  // Line Number
    ....)
    PoTotal      // Purchase Order Total

    Orders Transaction rule:

    Serial(PoLineNbr, PoLstLineAsg, 1)

    The first parameter (PoLineNbr) defines the attribute that is being numbered, the second (PoLstLineAsg) indicates which attribute carries the last assigned value. In this case, we are referring to the last assigned line number. The third parameter reflects the increment, which in this case is one. The attribute PoLstLineAsg should be included in the Transaction's structure at the PoNbr level (an order only has ONE LastLine assigned).

    In this way, for each new line within the order, the program will automatically assign a number.



    Created: 07/15/08 04:49 PM by dmarquez Last update: 05/18/09 11:44 PM by lcpc2009
     
    Page
    Categories
    Group
    Powered by GXwiki 3.0 Beta1 (generated with GeneXus X Evolution 1) gxwiki@gxtechnical.com