How to filter out past iteration showing only current version in a report?

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

Right now the current report have all the designs such as A1, A2, B1, B2, B3 in which the letters are the Design Model number and the # is the iteration.  Is there a method so that when A2 comes out, the report will filter out A1 showing only A2 and when latest B3 comes out, report will filter out B2, B1 and only showing B3? Any input is appreciated.

Photo of Yang

Yang

  • 0 Points

Posted 4 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 62,316 Points 50k badge 2x thumb
How about this.  Make a table of all your possible Design model numbers are listed. Let's say they can be from A to Z, so load up a table with the 26 letters and make the key field be the Design Model, ie, the letter.

In you details table make a formula text field of the Design Model.

Left([Design Model ID]),1)

Make relationship with the Unique Design Models table based on that field.  Then do a Summary maximum of the Record ID.  Then look that up down to the details table called [Record ID of latest Iteration]

Lastly, filter your report where [Record ID#] equals [Record ID of latest Iteration]
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,894 Points 20k badge 2x thumb
I created a simple example to demo a solution to your problem. I regards to your design identifiers A1, A2, B1, B2, B3 etc I broke the letter out into a field called [Design] and the number out into a field called [Version] and added another field [Name] to collectively represent the other fields you would undoubtedly have in your table.

Designs and Versions
https://haversineconsulting.quickbase.com/db/bj32bw29r

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=411


See attached screenshot.

The example used script, the QuickBase API, along with the JavaScript libraries jQuery (for AJAX processing and DOM manipulation), Underscore (for grouping and maxing)  and Mustache (for templating). The guts of the demo is this concise fragment of Underscore that does the grouping and maxing of the JSON data returned from the AJAX call (with the help of a XMLFlat to JSON converter):

var records = _
 .chain(data.records)
 .groupBy(function(val, key) {
   return val.design;
 })
 .map(function(val, key) {
   return _.max(val, function(item) {
     return item.version;
   });
 })
 .value();

Notes:

(1) Had to use converter property instead of dataFilter on AJAX call

(2) The rendered table does not look like much but a little extra CSS can give it all the style and appearance you want.