Unique line items in a table

I have table with 50 city names with some duplicate city names.  I only want one to show a city once.  how do I do this?

You could create an aggregate model or use javascript to abandonRow duplicate city names.

I did this. What else do I need to do?

Add all the fields that you want to display as aggregations, and then create a table on your model. You have to drag and drop the fields from the model field list into the model.

I looks like your table is still bound to the basic model.  You need to change the Model that drives the table to the aggregate one you built.  

But here is where things get tricky.   Every field you want to show in the table will have to be in the grouping section.  And there is no way to include formula fields in grouping statements (This is a core limitation to Salesforce SOQL).   

Actually Matt’s answer is a little misleading.   If you put your fields in the “Aggregation” section of your model - you won’t be able to show field values,  just do calculations like COUNT.   Helpful in some cases, but not in yours. 

If this does not work the solutions are going to be much harder - either Apex code to prevent the duplicate entries,  or Javascript code to analyze the model presented to the client and abandon the duplicate rows.  Both of these are outside the bounds of what we can provide in basic support.   

You could use agg model as a condition to a basic model. In the agg model, set your conditions as desired and group by City and Id.

In your basic model, set the condition on Id to be “in” the agg model id values.

Great solution there from Pat.

Rob, I’m pretty sure I’ve used MAX ‘aggregations’ for text fields with success. But groupings does seem to make more sense.

Hello Pat,

Thanks, that seems like it should work.  I believe I have followed your instructions but not yet working.  Here is how i have it set up:



Should work. Do you have skype? pat.vachon.77

Don’t think this will work.  If 2 rows in basic model match the row in the aggregate model - you still have duplicate rows in your table. 

yes. I will c

Thanks Pat that worked great.