Make table render unique values

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have a table A, which is populated by users taking an action in another table B. They do so to add question to their metric set.
The data model in question involves three objects

Concept A            Question A           Metric Set A
Concept A            Question B           Metric Set A
Concept B            Question C
Concept C            Question D           Metric Set A

When users select to add question A or Question B to their metric set, both A and B get added to their Metric Set, because they have the same Concept. This is important for backend functionality, but quite confusing to a user. THe ideal functionality would be for the two questions to be added to the metric set, but for the skuid table to only render a single question for every concept included. Essentially, it would deduplicate based on the concept, ie:

Concept A            Question A           Metric Set A
Concept C            Question D           Metric Set A

There is a lookup relationship between concept and question. Appreciate any thoughts
Photo of Santiago Perez

Santiago Perez

  • 362 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Need to see the schema and/or video of what you're trying to do. It isn't clear what you are asking. Either that or I need to get a coffee.
Photo of Santiago Perez

Santiago Perez

  • 362 Points 250 badge 2x thumb
Its a tough one. This video we recorded during testing might be helpful
http://screencast.com/t/9ZLsWuvtMZDs

It shows someone populating the table (Labeled Step 2: Metics in Metric Set) by clicking on two Concept records, one of which houses two questions, the other only one.

The objective would be that the Step 2 table would deduplicate and only render one row per unique value of the "Question Concept Name" field, even though in fact 2 records were added to the underlying object because there are two questions in that concept.

To make things simpler, s there a way to render rows in a table based on whether the value of a field is already present in earlier rows in the table? Such that the second row in the video with Question Concept Name=AdditionalBenefits would not render?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Alright. I need to understand what's related to what in which in order to properly answer. What objects are being used and what are reference fields?
Photo of Santiago Perez

Santiago Perez

  • 362 Points 250 badge 2x thumb
Here's the schema. The objective is that, as I create Metric Set to Question records, that the table only show the Question if there is not already another question in the Metric Set with the same Question Concept.
.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Santiago,

You might be able to do this with an aggregate table... along the lines of this:
https://community.skuidify.com/skuid/topics/unique-line-items-in-a-table
Photo of Santiago Perez

Santiago Perez

  • 362 Points 250 badge 2x thumb
Hi Matt, I spent a good amount of time trying and did not succeed. If your objective where to prevent more than one record that contains a particular value form rendering in a table, how might you use aggregations to achieve it? Could use some tips
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I don't think you are going to be able to make a condition on the model to dedupe concepts out of the question set.  I think you are going to need some combined model strategy.  Here is a rough sketch.
1. Build a model on "metric set"
2. Under each metric row add a drawer that retrieves the rows from another model
3. This second model has the question concepts, and accepts a condition on its granparemtn (metric junction object) so that a concept is only shown once under each metric.  
4. Add a child relationship field to the concept model that retrieves question information.  Limit the child relationship to only show one record.  The "Order by" property in the child relationships will let you choose which of the questions to show. 

I've not modeled this out, but think it should work. 
Photo of Drew Piston

Drew Piston

  • 60 Points
Hi Rob,

I'm helping out with this project as well -- your idea is good, but unfortunately some of the Questions are "orphans" and don't look up to a Question Concept.

Would there be any way to include those as well?

Thanks,
 Drew
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Well sorta.  In the drawer under each metric set row you could have one table of Concept Questions,  and another table of orphan questions.  I don't think your data model allows you to do anything else declaratively.