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

4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • 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.

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

      Like
    • 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. 

      Like
  • Grazie per le informazioni

    Like
Like Follow
  • 1 mth agoLast active
  • 4Replies
  • 35Views
  • 3 Following