Button/Timestamp
Afternoon all,
I am Ninox newby and I am trying to get my head around the coding language/syntax.
What I am trying to do is to trigger a timestamp (DD/MM/YY) inside a formula field (called 'Time Stamp') through the use of a button (called 'Reset').
Please be aware that inside the button's formula field I have already set up a formula that makes me copy and paste a column into another column. This is the formula:
for thisRecord in select Items do
let a := thisRecord.'Value of units completed';
thisRecord.('Paid/Applied to Date' := a)
end
I came out with my only version of the formula
let a := "Reset";
if a = true then now() else void end
Unfortunately this formula seems not working.
Thanks in advance for your help.
Stefano.
8 replies
-
@Stefano
I am a little confused. When you click the "Reset" button.. you execute the above described for loop.. What are you trying to accomplish with the Time Stamp formula ?
Why not just put the setting of the timestamp field inside the button logic ?
-
Good afternoon Mconneen,
Thanks for your replying.
I have finally managed to make the formula working using the following code:
'Time Stamp' := now();
for thisRecord in select Items do
let a := thisRecord.'Value of units completed to Avonline';
thisRecord.('Paid/Applied to Date' := a)
endThe only problem now is that during the column copy and paste, Ninox gets into some sort of infinite uploading.
I have more than 5000 cells to be copied from one column and pasted into a new one (overwriting the previous values) so probably this is why requires lots of time.
Is there any way to speed up the process/improve my code in order to be quicker?
Thanks,
Stefano.
-
@Stefano,
What platform are you running? Mac App, iPad, Web ??? I am on the Mac app..
I created 5000 item rows in about 25 seconds.. I then looped through each of the 5000 rows and copied one field to another .. and nulled the original field in about 38 seconds.
Here are some screen shots.
-
Crap.. hit post .. the rest of the screen shots.. :) Also.. please note.. if your Items table has views.. or is on other views.. After each update.. those views are re-evaluated (or at least that is what support told me a while ago)... so that will slow it down too.
-
Good afternoon Mconneen,
Thanks again for getting back to me.
I am working on the Web App and even if I have hidden the columns it is still taking ages to copy and paste. Perhaps I can apply some changes to my formula in order to make it more efficent?
Thanks,
Stefano.
-
It's now working with the following code:
do as server
for thisRecord in select Items do
let a := thisRecord.'Value of units completed';
thisRecord.('Paid/Applied to Date' := a)
end
end
-
Excellent.. Yes "do as server" will execute the code on the server.. else it is round tripping per record.. :)
-
Thanks for helping me out
Content aside
- 5 yrs agoLast active
- 8Replies
- 2520Views