Hi Codans, I’m trying to make a reschedule button for tasks but it doesn’t seem to work.
So for the “date” update value
If(Date< Today(), Date= Today(),CurrentValue) , it says unexpected error. What do I do wrong?
Thanks in advance
Hi! The proper way to do this would be using the ModifyRows() function, rather than if “If()” function, doing something like this:
ModifyRows(thisRow, .[Date], Today())
The reason the If() function doesn’t work is because it is only going to return the value of “Date = Today()” (which is a boolean) when “Date < Today()” is true, and won’t actually assign Date to Today(). To make a change to the value of Date, you need to use ModifyRows.
Another easy way to do this is using the built-in button creation drop-down menu and using the modify rows action.
Hope that helps!
Are you setting it in the UI as a value for a “Modify rows” action? If so, you have an incorrect formula. The correct one would be: If(Date < Today(), Today(), CurrentValue)
, or if this one doesn’t work (not sure if CurrentValue applies in this context), a bulletproof one would be If(Date < Today(), Today(), Date)
.
If you’re writing your whole action as a formula, it must return an action. Then you need something like this: If(Date < Today(), ModifyRows(thisRow, Date, Today()), _NoOp())
. NoOp is a hidden action that does nothing, but is useful in cases like this when there both results of an “if” evaluation must return an action.
The 2nd approach is better because it doesn’t try to update the row with the same date value.