Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

Assigning multipls DB table columns to multiple CB fields

  • MMDoege
  • MMDoege
  • OFFLINE
  • Posts: 98
  • Thanks: 3
  • Karma: 0
7 years 9 months ago #292613 by MMDoege
Hello,

In "CB Query Tutorials - 04 - articles list table" Nant explains how to DISPLAY multiple rows and columns. I wonder if this is possible for STORING multiple coulumns in a related number of CB fields.

How can I retrieve 1+ columns from DB table and assign them to 1+ CB fields?

This simply doesn't work as target is just one CB field (query multiple or single):

"SELECT cb_industry_key, cb_industry_display_name FROM #_industry_table WHERE lang_tag='en-US';" does not work to assign 2 separate values to 2 CB fields.

Do I have to use
"SELECT CONCAT(cb_industry_key,'|',cb_industry_display_name) FROM #_industry_table WHERE lang_tag='en-US';" instead, parsing and splitting apart values into separate CB fields using CB Auto Action afterwards?

Use case is quite simple: Get the index key of a displayed DB table cell user has choosen.
However for my CB app this is essential and required for many CB query fields.

Thank you.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48709
  • Thanks: 8319
  • Karma: 1447
7 years 9 months ago #292618 by krileon
CB Query Field outputs the results of your query as the field you created (the query field). To output multiple columns you need to use the appropriate Output mode under the Display tab as shown in the below tutorial.



If you need both values, but as separate fields then you need to create 2 query fields.


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum