Discussions

Expand all | Collapse all

Auto Fill Date Field Based Off of Another Field

  • 1.  Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 19:46
    Hello, 

    I would have three fields that I would like to work together, [Status], [Scheduled Date] and [Completion Date]. Essentially I want the [Completion Date] field to auto fill with the same date as the [Scheduled Date] field once the [Status] field is equal to "Complete". 

    Any thoughts on how to make this work? I'm a little new at QuickBase. 

    Thanks!


  • 2.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:29
    You will need to set a "dynamic form rule" to populate that date, when your status field is changed.  

    If you are an Admin on the account and you open up one of the records
    >
    In the top right you will see "Customize This Form"
    >
    After opening up those settings, click on the "Dynamic Form Rules" tab
    >
    Create a new rule with the needed logic
    >
    Something to the affect of:

    Condition
    If [Status] is equal to "Complete"

    Action:
    Change [Completion Date] to the value in the field [Scheduled Date]


  • 3.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:40
    I thought for sure this was going to work, however it just enters in todays date instead of the date from the field. 

    After conducting further research this may be because of how it is set up. I have on another table a URL button that when pressed, changes the [Status] field to complete. For some reason when this is pressed it enters todays date in the [Completion Date] field. If I manually on the record change the [Status] field to complete it works properly. 

    Any thoughts on how to fix this so the URL button will work?


  • 4.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:43
    Can you past the button code in here? It may be coded to populate the date field.


  • 5.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:47
    var text url =
      URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
        "&rid=" & [Record ID#] &
        "&apptoken=biyf682cpfpeqfbfpv8pida6k3gy" &
        "&_fid_15=Complete" &
        //"&_fid_57=true" &
        "&_fid_17=" &Now();


    If([Status]="Complete","",
    "<a class=\"Vibrant Primary\" href=\"javascript:" & "$.get('" & $url &
        "', function(){" & "location.reload();" & "});" &
        "void(0);\">Complete</a>"
    )


  • 6.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:49
    Field ID #15 = [Status]
    Field ID #57 = Looks like a note, because I only have 30 fields
    Field ID #17 = [Completion Date]


  • 7.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:56
    &_fid_17=" & URLEncode([Scheduled Date]);


  • 8.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:56
    the portion that has "&_fid_17="&Now();
    is already writing the date.  

    Any reason why you don't want to keep using the button to mark things complete.

    I much prefer buttons over form rules.


  • 9.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:59
    Matthew, 

    I definitely want to continue using the button. I will try Chris' update to the button code to get it to populate the correct date. 


  • 10.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 21:01

    It has occurred to me after reading over this thread that you may be trying to write a date field value to a date/time field value.

    Now() is a function that gives you the current date 'and' time of day. Are both [Completion Date] and [Scheduled Date] Date/Time fields? Or, is one of them just a Date field?




  • 11.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 21:01
    SUCCESS!!! Thank you guys so much!!


  • 12.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:31

    Andreonna,

    Are you certain the two dates will always match? Is it not possible that [Completion Date] may occur sooner than or later than [Scheduled Date] ?



  • 13.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:34
    The field needs to be able to be edited in the case that they are not the same. 95% of the time they will be the same date. 


  • 14.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:40

    You would auto populate the [Completion Date] field much like Matthew said, except when [Status] = "Complete", change [Completion Date] to the current date in the form rule. You will still be able to edit the [Completion Date] field manually, the form rule allows you to populate the date field automatically upon a certain condition.

    In the form rule, you may want to check the box that says, "change occurs when condition changes from false to true". This will keep the [Complete Date] from changing to the current date every time the record is edited subsequent to its completion.



  • 15.  RE: Auto Fill Date Field Based Off of Another Field

    Posted 03-14-2017 20:42
    Chris, Can you please look at my comment on Matthews post as well regarding the URL button. This seems to be causing an issue. 

    Thanks!