[SOLVED] Combine User lists

13 years 11 months ago #135472 by Kingsley
[SOLVED] Combine User lists was created by Kingsley
Hi
I am relatively new to Joomla and absolutely new to CB,

is there a way to combine user lists in CB?
ie take 2 user lists, merge the data togther and then sort it ?

I am building a cb database with each CB entry as a "family" (say 2 adults and 2 children) rather than a cb entry only having 1 person. Yes, i know not perfect database design but if I split them all as individuals would then have 4 (or more) individual records and duplication of postal addresses, phone numbers, contact info for each child of parents etc. So either way it is messy.

The problem is that I would then like to be able to create a list with all children (names) say between ages 10 and 15 all sorted by age.

So am potentially searching through more than 1 field (several date fields) and then harvesting only the relevant childs name (depending on date of birth).

Easy to search and sort for one child in the record, but need a seperate list to search for additional children. If I could then combine them and sort them, perfect.

Any suggestions would be appreciated.

If I need to jump into coding and SQL ... any suggestions on where to head for info ? I have done similar with ASP & Access in years gone by, but not played much with php. :)

Post edited by: krileon, at: 2010/06/21 16:51

Please Log in to join the conversation.

13 years 11 months ago #135627 by krileon
Replied by krileon on topic Re:Combine User lists
Yes this is possible, simply create a new userlist (list 3) then set the Sort By to be whatever field you're wanting (Age field?). You'll then need an advanced filter to filter the userlist to specific age ranges. Example of advanced filter as follows.

[code:1]
`cb_FIELD` >= 10
`cb_FIELD` <= 15
[/code:1]

Of course replace cb_field with your actual fields database column (field Name within Field Management).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 11 months ago #135669 by Kingsley
Replied by Kingsley on topic Re:Combine User lists
Hi Kyle thankyou for your reply.

Are you saying that it is possible to combine the output from more than 1 list into a seperate list?
If so how ?

Or I may not have explained myself correctly.

My CB database has records of say "families" with say 3 "children" in it.
++++++++++++++++++++++++++++++++++++++
Sample data of 1 record:
cb_field_Family_Name ... "Smith"

cb_field_child_1_name ... "Joe"
cb_field_child_1_age ... "8"

cb_field_child_2_name ... "Julie"
cb_field_child_2_age ... "11"

cb_field_child_3_name ... "Tim"
cb_field_child_3_age ... "14"

+++++++++++++++++++++++++++++++++++++
Sample data of another record:
cb_field_Family_Name ... "Tremble"

cb_field_child_1_name ... "Nicola"
cb_field_child_1_age ... "6"

cb_field_child_2_name ... "Harry"
cb_field_child_2_age ... "12"

cb_field_child_3_name ... "Max"
cb_field_child_3_age ... "18"

+++++++++++++++++++++++++++++++++++++
Aim: Display only children between ages say 10 & 15, sorted by age

Result desired:

Julie Smith, 11
Harry Tremble, 12
Tim Smith, 14

Problem:
result needs to display a field where which field is displayed is dependant on search results.
ie
display child 1 name only if child 1 age is in range.
display child 2 name only if child 2 age is in range. etc

possible solution?

Step1: List1: Search child 1 age in range and if so store child 1 name & family name & age
Step2: List2: Search child 2 age in range and if so store child 2 name & family name & age
Step3: List3: Search child 3 ...

Step4: Combine output from step1 & step2 & step3.
Step5: Sort output from Step4 & display

Question: is Step 4 possible ? how ?

Alternative Solution:
create new table in cb, push data from step1~3 into table, sort, display, drop table (to cleanup).

Any pointers to solutions or reference materials appreciated.

Please Log in to join the conversation.

13 years 11 months ago #135823 by krileon
Replied by krileon on topic Re:Combine User lists

Are you saying that it is possible to combine the output from more than 1 list into a seperate list?
If so how ?

No, this isn't possible and you need to create another userlist and using advanced filters adjust the output of the query. Advanced and Basic filters alter the userlist query directly so you'll need to use database functions, this allows for powerful customization of the userlists results. Don't think what you're wanting to do is possible without a custom CB Plugin to utilize CB Triggers (see tutorials within signature for trigger usage information).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 10 months ago #136150 by Kingsley
Replied by Kingsley on topic Re:Combine User lists
Thankyou Kyle,

I will explore other options and report back here if I find some.

Kingsley

Please Log in to join the conversation.

13 years 9 months ago #138280 by Kingsley
Replied by Kingsley on topic Re:Combine User lists
Looking forward to using 1.2.3 but also found a very flexible solution to problem.

I used sql 2 Excel ... a free (or paid) joomla module etc,

This gives full SQL flexibility in searching.
eg
My database has each record with several "family" members eg 2xadults and 4xchildren, each with relevant firstName, LastName, Group & Type (and lots more).

I used SELECT (& UNION SELECT) to search each family member (adult or child), for relevant group and type value, if matched ... then put into same column of spreadsheet (list), finally sort by column in list.

The CONCAT function joins text fields together ... in my case: FirstName, LastName & (familyName). I used this as sometimes the last name of children is different to family name of adult parent.

+++++++++++++++++++++++
SELECT jos_comprofiler.cb_adult1group1 AS Groups, jos_comprofiler.cb_adult1boattype1 AS Type,
CONCAT(jos_comprofiler.cb_adult1firstname, ' ',jos_comprofiler.cb_adult1lastname, ' (', jos_users.name, ')') AS Name

FROM jos_users
INNER JOIN jos_comprofiler ON jos_users.id = jos_comprofiler.id
WHERE jos_comprofiler.cb_adult1group1 = "Blue" OR jos_comprofiler.cb_adult1group1 = "Red"

UNION SELECT jos_comprofiler.cb_adult1group2 AS Groups, jos_comprofiler.cb_adult1boattype2 AS Type,
CONCAT(jos_comprofiler.cb_adult1firstname, ' ',jos_comprofiler.cb_adult1lastname, ' (', jos_users.name, ')') AS Name

FROM jos_users
INNER JOIN jos_comprofiler ON jos_users.id = jos_comprofiler.id
WHERE jos_comprofiler.cb_adult1group2 = "Blue" OR jos_comprofiler.cb_adult1group2 = "Red"

ORDER BY Groups, Type ASC, Name DESC
+++++++++++++++++++++++++++++++++

The inner join was to enable info to be pulled out of the standard Joomla fields, matched with CB fields.

Finally SQL2Excel also offers a datagrid plugin so results can be displayed in HTML or displayed as spreadsheet or downloaded as spreadsheet.

Little bit tricky to install as there are 3 or 4 "bits", but all worked really well.

This module saved me. :)
Kingsley

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.218 seconds

Facebook Twitter LinkedIn