Contains tips for configurators working with Aware IM
#4498 by czillman
Fri May 18, 2007 1:39 pm
Is there an elegant way to COUNT UNIQUE VALUES of an attribute?

I think this is the SQL
SELECT COUNT(DISTINCT column_name) FROM table_name

I cant figure out the bus rule
BO.CNTUNIQUEPARTNUMBERS = SELECT COUNT(DISTINCT BO.PARTSLIST.PARTNUMBER) FROM BO.PARTSLIST

#4511 by aware_support
Sun May 20, 2007 3:30 am
Unfortunately, right now this can only be accomplished as a Java plug-in.

#4515 by tford
Sun May 20, 2007 4:02 am
czillman,

If you are really desperate to do this & not into Java plug-in, you could keep a BO with unique values of a certain attribute using a method like posted at http://www.awareim.com/forum/viewtopic.php?t=1578&highlight=unique . You have to really be careful about accounting for all add/change/delete activity though. It seems complicated but it's not a ton of work. I would not want to use this method for very many attributes though.

After accumulating the unique attributes, you could then easy COUNT them.

Tom

#4539 by czillman
Tue May 22, 2007 6:11 pm
Thanks for the replies.

I've never written a java plug-in. What would I use to write the plug-in? Is there some sort of compiler that would be good for little simple thinkes like this?

cheers, charles

#4554 by aware_support2
Thu May 24, 2007 1:04 pm
Another idea is to maintain a unique parts list in addition to the full parts list. This could be done with the following rules on BO:

Add unique part:
If Part WAS ADDED TO BO.PartsList AND NOT(EXISTS Part WHERE (Part.PartNumber = AddedPart.PartNumber AND Part IN BO.UniquePartsList))
Then INSERT AddedPart IN BO.UniquePartsList

Remove unique part:
If Part WAS REMOVED FROM BO.PartsList AND NOT(EXISTS Part WHERE (Part.PartNumber = RemovedPart.PartNumber AND Part IN BO.PartsList))
Then
FIND Part WHERE Part.PartNumber = RemovedPart.PartNumber AND Part IN BO.UniquePartsList
REMOVE Part FROM BO.UniquePartsList


Then you can count the unique parts with the following rule:

BO.CntUniquePartNumbers = COUNT Part WHERE Part IN BO.UniquePartsList


This is similar to the approach mentioned above, except that it is limited in scope to a given object instance, does not require additional objects and takes care of removed list members.
#42167 by RLJB
Fri Jan 20, 2017 2:41 am
Has anyone managed to come up with a nice solution for this in the last 10 years?

We need to count unique instances, based on an attribute, any ideas? A custom function perhaps?
#42169 by tford
Fri Jan 20, 2017 2:01 pm
Hi Rod,

What's wrong with the solution support offered?
#42191 by RLJB
Mon Jan 23, 2017 12:44 am
Hi Tom

This is for a table/BO that is pretty large (it's a learning management system records store), so I want to avoid duplicating a massive table with more data.
#42413 by Jaymer
Wed Feb 08, 2017 9:08 pm
FWIW...
I had no idea what a "learning management system records store" was.
A simple google search showed some sponsored ads.

Saw a neat demo - COULD have been aware in the 1st 10 seconds (if you were REALLY good), then became apparent it was something else. VERY nice! Since we're all "in the biz", I'm sure someone could learn something (UX-wise) from this:

https://www.absorblms.com/features/

I looked at all 10 products on this page:
http://www.capterra.com/sem-compare/lea ... oCJaDw_wcB
and the Absorb product (linked above) was the only one that lets you see a ton of real screens so I didn't learn much from the other systems.

FYI
#53086 by RLJB
Sat Feb 08, 2020 4:49 am
Funny how the same need keeps arising... 3 years laters... does anyone have a nice function or solution for this yet, that isn't:

a. a stored procedure
b. creating another table of unique entries

tks
#53175 by ddumas
Tue Feb 18, 2020 2:13 pm
USE EXEC_SP, or the EXEC_SPF() function to return the value. I call stored procedures throughout my application, especially for queries. Also to set flags or calculated columns that are best left to SQL code
Know them, love them ,use them :)
#54220 by yahya
Mon Jun 29, 2020 10:07 am
What happens when you want to just display the unique values in a list? See my screenshot as an example.
Attachments
Screenshot 2020-06-29 at 12.04.08.png
List showing duplicated values in a list
Screenshot 2020-06-29 at 12.04.08.png (30.34 KiB) Viewed 295 times

Who is online

Users browsing this forum: No registered users and 5 guests