Deutsch English
Alphabetical index
Array functions
CGI functions
Data types
Date functions
Debugging
Fulltext functions
Language elements
Numerical functions
Operators
Other functions
  • choice()
  • dat2dbf()
  • dbf2dat()
  • execmacro()
  • getsession()
  • 'GETSESSIONIDENT'
  • md5_str()
  • nloop()
  • note()
  • note_a()
  • note_b()
  • note_i()
  • paramstr()
  • todbf()
  • xwert()
    Ramtext functions
    Selecting
    Socket functions
    Statistical functions
    Stream functions
    String functions
    System functions
    Table functions
    Text functions
    Home    Overview    Search    Impressum    Contact    Members
    Topic complex Other functions
    Function nloop()
    Short Multiple repeat of an expression calculation
    Syntax NLOOP(VAR i : INTEGER; max : INTEGER; Exp_1; Exp_2; ...) : INTEGER
    Parameter i : INTEGER
    max : highest value of i
    Exp_1, Exp_2 ... : any expressions
    Return
    See also:
    Description With executing the function the following happens:

    i is set to 0
    as long i is not bigger than max, at first the expressions Exp_1, Exp_2 ... are calculated and then i incremented with 1.

    Example: Mark the whole table
    VAR db, i : INTEGER;
    ...
    NLOOP(i,FILESIZE(db)-1,SETMARK(db,i+1))



    Example 1: StrSort

    Cross join of two tables sorted by the 1st and 2nd column

    VAR db_1 : INTEGER = opendb('database/customer.dat')
    VAR db_2 : INTEGER = opendb('database/orders.dat')
    VAR query : STRING = '$customer.KDNR=$orders.KDNR, $orders.date<=today-14'
    VAR result : STRING[,]
    VAR i,j : INTEGER
    InitArray(result[maxlabel(db_1)+maxlabel(db_2),filesize(db_1)*filesize(db_2)]
    
    SUB _query
    nloop(i,maxlabel(db_1)-1,result[j,i]:=getfield(db_1,i+1))
    nloop(i,maxlabel(db_2)-1,result[j,maxlabel(db_1)+i]:=getfield(db_2,i+1))
    j++
    ENDSUB
    StrSort(result,j-1,0,'1,2')


    User comments:
    Write a comment:
    Name
    EMail
    Subject
    Text (Switch mode)

    Choose between
    the normal and the
    advanced editor.
    The advanced editor
    runs in IE 5+ and
    Mozilla 1.4+ only
    SPAM-Protection Please enter tdbengine in this field.

    tdbengine chat
    irc.tdbengine.org
    #tdbengine

       Copyright © 2003-2004 tdb Software Service GmbH
       Alle rechte vorbehalten. / All rights reserved
       Last changed: 21.10.2004
    {Fehler für :execmacro{execmacro="sessionspy"}