Forum Discussion

DavidRevel's avatar
DavidRevel
Qrew Trainee
2 years ago

Merge data from two tables on a form

In a project management app, I have two tables to capture expense records. Expense A contains accounts payable bills, entered manually. Expense B contains credit card transactions. They must be separate because Expense B syncs to credit card company using the credit card company's record ID as the key field​.


Both tables have similar data: transaction date, vendor, amount, etc. Both tables are related as children to a parent Job table. Data from the two Expense tables is summarized in a formula field that combines the two sets of related Expenses. I would like to be able display a list of all expenses related to a given job as a single report on the Job form like one might with a report link field.

My current, clunky solution is to have a third table: Combined Expense. Since I want a list/report of all data from Expense A and Expense B, I made Combined Expense a child to both Expense A and Expense B with lookup fields to gather the data, and a third field to combine the two sets of lookup records. Pipelines handle adding and deleting child records in the Combined Expense table, triggered whenever entries are made in Expense A or Expense B.

My solution is functional but clunky, as data displayed in the Combined Expense table is not easily edited (grid edit for example), and the slow response of Pipelines can cause some consternation among users, not to mention the fact that it's a fair amount of pipeline cycles and management of pipelines.

Ideally, I'd like to generate the Combined Expense table report on the fly, so to speak, to display records from both Expanse A and Expense B on a form in a single report.

Thanks for your help!





------------------------------
David Revel
------------------------------

5 Replies

  • David,

    My initial thought was just to propose having the sub-reports of Expense A and Expense B shown in the "Job" form...say in separated tabs. In this way you wouldn't have to worry about the clunky pipeline issue.

    For totals, you could simply have a summary field for each sub-report of A and B, then create a formula field that totals those two summary fields.

    Right now, that's my best suggestion, but I'm not sure that solves your problem.



    ------------------------------
    Ryan Buschmeyer
    ------------------------------
    • DavidRevel's avatar
      DavidRevel
      Qrew Trainee
      Ryan,

      This is how I have it set up now...I am just not a fan of the UI/UX for this and was hoping for cleaner experience.

      ------------------------------
      David Revel
      ------------------------------
  • I think you did it backwards, so that combined expense needs to be a parent of Expense A and Expense B, then you could bring in summary fields and use formulas to combine the two

    ------------------------------
    Sean Boat-Moore
    Manager SMB Development
    Project Management Office and Quality Control
    NCR Corporation
    sean.boat-moore@ncr.com | ncr.com
    ------------------------------
    • DavidRevel's avatar
      DavidRevel
      Qrew Trainee
      Sean,

      Thanks for your feedback. I already have summary fields and formulae to combine, but I would like to be able to have a line item list (report) in the parent form, not simply a summary.

      Thank You,

      ------------------------------
      David Revel
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew #1 Challenger
        One approach is to create a third table to hold the combined data from both tables.
        I would set the Key field of that combined table to be a custom Key field on the frmat like 
        A-1234

        The prefix would be an identifier of the first table for example table A or whatever it is.  The suffix will be the [Record ] field of the source table.

        I would then create fields in the two respective source tables to calculate the Key field of the consolidated tables, for example

        List ("-", "A",  ToText([Record ID#])

        Then set up two saved table to table imports to merge in the data from the source tables into the target table.  When you run them it will populate the consolidated table.   

        Question will be how you keep the consolidated table synchronized with the source tables as records are added edited or deleted in the source tables.  

        There are a variety of approaches and it may depend on how current you need the data to be in the consolidated table. 

        For example, if it was good enough to have the table only updated once a day then that could be an overnight process which delete all the records in the consolidate the table and then uses a pipeline copy record step or a make request step to call an API to run those to save table to table imports. 

        If you need the data to be updated in the consolidated table more on a "live" basis then one approach would be to continue with the overnight process as a safety net but meanwhile during the day you would have a pipeline that would run which would trigger when records were added or modified in the source tables to make that same update in the consolidated table.  Actually would probably need three different pipelines, one to deal with the situation when the record is added in the star stable one for a modification and one for a delete. Then of course you will need to replicate those pipelines for changes in the other source table.

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