Skip to main content
Question

Formula Field is Updating Outside of Record Interaction

  • June 19, 2023
  • 0 replies
  • 52 views

Hi everyone,

I have a formula field (see code below) that gets the current date and time. Then formats it to a certain way. The issue I'm having is that this formula field updates the content of the field outside of Edit>Save Record operations. 

Ex.
1) If I go a table and view all the records. The formula field updates everytime I refresh the page.
2) If I go to edit a record, then discard any changes. The formula field updates.

PS. If there is a better way to format the date, please let me know!

//Intended Time Format 12/21/2021 17:00:19

//Get time
var number numHour = Hour(ToTimeOfDay(Now()));
var number numMin = Minute(ToTimeOfDay(Now()));
var number numSec = Second(ToTimeOfDay(Now()));
//convert to String
var text getHour = If(ToNumber($numHour) < 10, ToText("0"&$numHour), ToText($numHour));
var text getMin = If(ToNumber($numMin) < 10, ToText("0"&$numMin), ToText($numMin));
var text getSec = If(ToNumber($numSec) < 10, ToText("0"&$numSec), ToText($numSec));
var text getTime = $getHour & ":" & $getMin & ":" & $getSec;

//Get Date format
var text getDateFormat = SearchAndReplace(ToText(Today()),"-","/");
//Put it all together
var text setTime = ToFormattedText(Now(),"HHMMSS");

var text dateTimeFormat = $getDateFormat & " " & $getTime;
var text setDateTime = If([Enabled for Execution]=false, $dateTimeFormat);

$setDateTime


------------------------------
Jason Ponce
------------------------------
This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24

When you use Now() in a formula it's always the current time.

As they say, "Time waits for no man".

What "Anchor Date" do you Want to uSe instead.  If you base the formula on the built in field [Date Created], then it would stable based on the date the record was first saved.



------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------