How to eliminate duplicate data in CDD ?

molcomp

New Member
Hi,

I tried several options but I either get an error or all the data are not displayed from the dropdown menu.

I have a CDD element in a table overlapping with following concat
(SELECT activity_name FROM activities WHERE id = {thistable}.activity_name)

{thistable} (intemgroup1 table name) is a relational table containing IDs of the other tables.
Project Activities Subactivities
1 1 1
1 1 2
2 1 1
etc

So in the dropdown list I get all the data related based on the watch field which is project. so I get the following dropdown:
Project 1

Activities dropdown list 1,1,2,2,2,2,3,3,3,3
(with the concat in the dropdown list names are displayed not the ids)

I want to display only one value of the activity not all the options.

The last thing I tried is below but it displays empty dropdown list under activities.
I must be missing something and if anyone had similar issue I appreciate your help.

In where clause under CDD element:

(SELECT DISTINCT activity_name from intemgroup1)

Thanks
Alex
 
I don't understand your setup.
A table used in Fabrik needs a unique id (PK) column (you can't use e.g. composite PKs).
DD and CDD elements are storing such a PK in the database.
If you get identical activity_names in your dropdown something is not unique.
 
Hello troester

Thank you for your help. Its all good its been a while since i have used fabrik many years ago :). I resolved the duplicate records using the following query:

->select(array('DISTINCT intemgroup1.id', 'activities.activity_name'))
->from('intemgroup1', 'activities')

I have another problem though hopefully I will resolve it over the wknd.

Thank you again
Alex
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top