0

loop thru entire Table to enter a Value

Hello i need just a simple Countup thru complete Table. In Table "UNITS" the Field "Zahl" shuold be countet up by pressing a Button:

 

with this it count only up in Row 1....

let t := this;
let getrecs := (select UNITS);
let getIndex := index(getrecs, t);
let i := 0;
for i from 1 to 11 do
    t.(Zahl := i);
    index(getrecs, i);
    i := i + 1
end

1 reply

null
    • Fred
    • 6 days ago
    • Reported - view

    You don't tell the for loop to iterate through any records.

    let t := this;
    let getrecs := (select UNITS);
    let getIndex := index(getrecs, t);
    let i := 0;
    for i from 1 to 11 do
        t.(Zahl := i);
        index(getrecs, i);
        i := i + 1
    end

    Line 1: you gather the current record into variable t.

    Line 2: you gather all of the records in the UNITS table into variable getrecs.

    Line 3: you get the index value of the current record in the array in the variable getrecs.

    Line 4: you set the variable i to equal 0. FYI, not something you need to do in Ninox.

    Line 5: you start your for loop but have it loop through numbers 1 - 10. You may want to consider:

    for i from getrecs do
        i.(Zahl := index(getrecs, i) + 1);
    end

    Now the for loop says for each item in getrecs do the following.

Content aside

  • 6 days agoLast active
  • 1Replies
  • 21Views
  • 2 Following