Options

Create Timer in a loop

Will_SVWill_SV Member Posts: 13
Hi There,

In a CodeUnit I start several Timer each with three lines:

IF CREATE(NTIMER01) THEN;
NTIMER01.Interval(GetIntervalToTimer(1));
NTIMER01.Enabled(TRUE);

IF CREATE(NTIMER02) THEN;
NTIMER02.Interval(GetIntervalToTimer(2));
NTIMER02.Enabled(TRUE);

Is there a chance, to change the number with i and do a loop like

For i := 1 to 30 do begin
IF CREATE(NTIMER0 + i) THEN;
NTIMER0 +i .Interval(GetIntervalToTimer(i));
NTIMER0+i.Enabled(TRUE);
END;

Thanks a lot !!!!!

Comments

  • Options
    garakgarak Member Posts: 3,263
    no because the create() statement requ. an existing variable name. And the variable NTIMER0 + i does not exist.
    C/AL is here not so flexible like other programming languages, because it's an ERP system with an simple embedded "development studio" and it's not like C# or c++

    And don't start the timer in CU1. Create your own Cu with the timer and run the CU from CU 1.
    Like Navision it does in Funktion NASHandler() in CU 1.

    Regards
    Do you make it right, it works too!
  • Options
    Will_SVWill_SV Member Posts: 13
    Thanks anyway!!!
  • Options
    garakgarak Member Posts: 3,263
    Please and Welcome
    Do you make it right, it works too!
Sign In or Register to comment.