How can i create a formula to change the value of [Date field A] to the value in [Date field B], then THEN delete the date in [Date field B]?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered

I'm writing a formula to change a bunch of fields when a button is clicked. Some of the fields are meant to track the previous value of another field. I need to update a field with the value in another field and then clear out the original value of that field.


[Date field A] = 10/12/16

some change requires [Date field A] to be cancelled and rescheduled, but we don't know the new date yet.

i want to update [Date field B] with the date that is in QB right now (10/12/16) and then delete the data in [Date field A] so that it is now blank.

my current formula is:

URLRoot() & "db/" & Dbid() 

& "?act=API_EDITRecord&rid=" & [Record ID#]

& "&_fid_1302=_fid_24&_fid_1380="&" "

& "&disprec=1"

Photo of M

M

  • 80 Points 75 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,806 Points 50k badge 2x thumb
Try this

URLRoot() & "db/" & Dbid()
& "?act=API_EDITRecord&rid=" & [Record ID#]
& "&_fid_1302=" &ToText([Field B])
& "&_fid_1380="
& "&disprec=1"
Photo of M

M

  • 80 Points 75 badge 2x thumb
fantastic! Thanks Mark. I was driving myself blind with all the quotes i had in there.
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
I'm trying to do something similar, but I'm trying to create a 'clock in' formula URL button that changes the Time In (time field) to the current time. Here's the code that I have so far:

URLRoot() & "db/" & Dbid()
& "?act=API_EDITRecord&rid=" & [Record ID#]
& "&_fid_7=" & NotLeft(ToText(Now())," ")
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,806 Points 50k badge 2x thumb
Try this



URLRoot() & "db/" & Dbid()
& "?act=API_EDITRecord&rid=" & [Record ID#]
& "&_fid_7=" & Trim(NotLeft(ToText(Now())," "))
& "$disprec=1"
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
I get this:
<qdbapi>
<action>API_EDITRecord</action>
<errcode>30</errcode>
<errtext>No such record</errtext>
<errdetail>Missing "rid" parameter.</errdetail>
</qdbapi>
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,806 Points 50k badge 2x thumb
You cannot use an API to Edit  a record which does yet exist. If you are trying to set a field to the current time, I suggest using a checkbox to trigger s form rule to set a Time of day field to the current time.
Photo of Kelly

Kelly

  • 1,812 Points 1k badge 2x thumb
I tried saving, and then clicking the button, but got this:

<qdbapi>
<action>API_EDITRecord</action>
<errcode>0</errcode>
<errtext>No error</errtext>
<rid>41</rid>
<num_fields_changed>0</num_fields_changed>
<update_id>1479054385121</update_id>
</qdbapi>