[SOLVED] CB Query field, comma delimed column value at multiple rows.

2 years 2 weeks ago - 2 years 1 week ago #329166 by NFA
My SQL query returns one DB value in one or more rows. In case there are more than one row, I want the output of this CB Query Field displayed comma delimited. In case of multiple columns in one DB row, there is a very nice drop down option to get that done perfectly. However, I miss something like that when the DB returns one column in multiple rows.

Problem, I really don't want an extra comma.

So, I have a CB Query Field with Output Multiple Rows and put "[column_name]," in the Display - Row.

This returns one value or multiple values, comma separated. Only it always ends with a "," after last value. How can that be removed?

Please Log in to join the conversation.

2 years 2 weeks ago #329172 by krileon
Easiest way is probably to add the delimiter using CSS. Surround the columns in a <span> with a custom CSS class then use CSS to add the comma. Another option is to set Output to Template and implement your own custom parsing behavior. Will review adding support for Multiple Rows > Single Column > Delimiter output as well.

forge.joomlapolis.com/issues/8930

The below is example of CSS based solution.

Row:
<span class="cbCommaColumnList">[column_name]</span>

CSS:
.cbCommaColumnList + .cbCommaColumnList:before {
	display: inline;
	content: ', ';
}


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.

2 years 2 weeks ago - 2 years 2 weeks ago #329173 by NFA
I don't think css/template/html can work in my case. Because I will never display those results. I just need a cb_QUERYFIELD with a comma delimited value to parse that with CB substitution as parameters to a module (by using the Modules Anywhere - Override Parameters option docs3.regularlabs.com/modulesanywhere/tutorial/override-parameters).

My code should become something like:
[cb:if user="#displayed" cb_QUERYFIELD != ""]{module id="319" cids="[cb:userdata field="cb_QUERYFIELD" user="#displayedOrMe" /]"}[/cb:if]

This CB Query input works fine, but only if there is no comma at the end or the beginning, so I have to find a way to remove the extra comma first.

P.s. I hope that forge.joomlapolis.com/issues/8930 will see daylight soon as it would be so valuable and powerful ;-)

Please Log in to join the conversation.

2 years 2 weeks ago #329174 by krileon
Will take a look at implementing support for this tomorrow since my workarounds above only work if actually displaying.


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.
The following user(s) said Thank You: NFA

Please Log in to join the conversation.

2 years 1 week ago #329181 by krileon
This is now implemented in latest CB Query Field build release. There's now a parameter to select if Single Column or Multiple Columns when using Multiple Rows output. Default is Multiple Columns and is same behavior as has always existed for Multiple Rows. With Single Column you'll be able to select a delimiter (e.g. comma) to combine the first column of each row.


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.
The following user(s) said Thank You: NFA

Please Log in to join the conversation.

2 years 1 week ago #329182 by NFA
I just tested it and yes this will be really helpful for my websites to pass data to other software components. Thank you so much!!!
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.586 seconds

Facebook Twitter LinkedIn