Forum Discussion

DanielJohnson2's avatar
DanielJohnson2
Qrew Trainee
3 years ago

Get field from different records in the same table, related to parent?

Hi All,

I'm trying to create an audit log with Pipelines with the intention of tracking how long a record is in each particular status and thought using {{a.$prev.updated_at}} would work to record the last time the status was changed. I have a Pipeline in place now that creates a record in a child table every time a specific multiple choice field is changed. However, {{a.$prev.updated_at}} isn't sufficient because someone might go in and add a note to the record, or attach a file to it, or any number of things that don't have to do with the multiple choice (in this case production status) field in question. My understanding is anytime the record is saved that time is logged in {{a.updated_at}}. When the Pipeline fires it also records the Record ID of the parent record that's having its status changed. My goal is to get the time between status changes in that child table. How can I do that? Is there a solution in relating the child table to itself? Another Pipeline? Is it even possible? Is there a more complex bit of language like $prev where I can say {{a.$prev.updated_at}} only for instances where that specific field changed?

Thanks.

------------------------------
Daniel
------------------------------

4 Replies

  • My suggestion is to use a child table like you suggested, but on each record you would have three fierlds

    Status,
    Start date/time 
    End date/time.  

    The pipeline would detect and trigger two steps.  One would be to search for any existing children (there should only be one) and update their End date/time.  Then it would create a new record for the start of the New Status.

    Then, of course each child will have a duration by calculation.  Then you can embed a summary report on the parent of the total duration by status or else make separate summary fields for the total duration for each separate status choice.


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • DanielJohnson2's avatar
      DanielJohnson2
      Qrew Trainee
      Thanks For the reply Mark. How do I tell the Pipeline which record to update with the End Date/Time in the child table?

      ------------------------------
      Daniel Johnson
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        Well, if the status changes, then any existing children with  an empty End date need to be updated.  So you would have a search step, then a For Each loop which would update the end date time.  There is Jinja syntax for the current date/ time, or else you can create a field in native quickbase for the current date and time and use that field to populate the date time field.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------