0

New result line in the console

How do I write a new result line in the console?

This is the code I run

let LastDate := last((select Notify) order by Data).Data;
text(LastDate);

while today() > LastDate do
    LastDate := LastDate +1;
    text(LastDate);
end

Actual Result

15/08/2022

Expected Result

15/08/2022
16/08/2022
17/08/2022
....

 

Thanks

4 replies

null
    • Danjamesmedia
    • 2 yrs ago
    • Reported - view

    The console will only output the last returned value, so you'd need to create a variable and keep adding to it in your loop, or an array and then aggregate it as a single string. In both cases just output the variable at the end.

     

    Appending to a string example:

    let LastDate := last((select Notify) order by Data).Data;
    let output := text(LastDate);
    
    while today() > LastDate do
        LastDate := LastDate +1;
        output := output + "
    " + text(LastDate);
    end;
    
    output
    

    Array example:

    let LastDate := last((select Notify) order by Data).Data;
    let output := [text(LastDate)];
    
    while today() > LastDate do
        LastDate := LastDate +1;
        output := array(output,[text(LastDate)]);
    end;
    
    join(output,"
    ")
    

     

    Both output the same result.

      • Antonello_Stabile_71
      • 2 yrs ago
      • Reported - view

      Dan James (Ninox Partner) qualcuno saprebbe spiegarmi a cosa serve la console?

      • Danjamesmedia
      • 2 yrs ago
      • Reported - view

      Antonello Stabile 71 the console is a place where any ninox code can be run outside of the scope of an individual table. It’s often used for:

      - testing formulas

      - performing bulk changes to data

      - testing queries that would eventually be run via the API

      Its scope is global, so any code in a button/trigger at table level will likely need to be refactored to work in the console. 

    • Antonello_Stabile_71
    • 2 yrs ago
    • Reported - view

    Grazie per le informazioni

Content aside

  • 2 yrs agoLast active
  • 4Replies
  • 77Views
  • 3 Following