[SOLVED] Query issue

2 months 1 week ago - 1 month 4 weeks ago #330940 by galanopd
[SOLVED] Query issue was created by galanopd
The following query produces the expected results in DB Fiddle but when I am using it in CB field Query Drop Down (Single select)->Parameters->Query, it doesn't show anything. No console errors.
Am I using the right kind of field or something else is wrong?
SELECT
  x.`title`
FROM
  `#__occupation_data` AS x
  JOIN `#__occupation_data` AS y ON SUBSTRING_INDEX(x.onetsoc_code, '-', 2) = SUBSTRING_INDEX(y.onetsoc_code, '-', 2)
WHERE
  y.`title` = '[cb_cat_bus2]'
  AND right(x.onetsoc_code, 2) > '00'
ORDER BY
  x.`title`

Thanks


Edit: '[cb_cat_bus2]' is a text field with autocomplete while this field (cb_subcat_bus2) is a Query Drop Down (Single select) that uses the above query and updates on cb_cat_bus2

Please Log in to join the conversation.

2 months 1 week ago #330947 by krileon
Replied by krileon on topic Query issue
I cannot help you debug your own queries. Be sure you've configured the query select field correctly. You can see a working example on our demo site below.

demo.cbdemosites.com/

Use the Login As to login as Administrator and review either of the following fields.

cb_region
cb_country
cb_state

Below is also a simple working example.

Parameters > Query:
SELECT * FROM `#__users` LIMIT 10
Parameters > Options
Value Column: id
Label Column: name


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 months 6 days ago #330956 by krileon
Replied by krileon on topic Query issue
Try removing the dependency on cb_cat_bus2 in your query and see if it outputs some options. It's possible the Update On isn't working in combination with the auto complete.


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 months 6 days ago #330966 by galanopd
Replied by galanopd on topic Query issue
I have tested it and it works fine.
It looks like the error is a logical one.
Working on it...
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

2 months 2 days ago - 1 month 4 weeks ago #331004 by galanopd
Replied by galanopd on topic Query issue
Solved it!
All happened due a dot in the code format that I thought it was a dash, so the query couldn't find it.

All work now,

Thanks anyway!
 
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

1 month 4 weeks ago - 1 month 4 weeks ago #331067 by galanopd
Replied by galanopd on topic Query issue
Note: This comment is moved from EDIT in previous post to here.

Here is something I noticed. The autocomplete text field works fine and the depended query single drop down list field updates fine, BUT if I set conditionals to the text field, then it doesn't load from the db when I type. In this case I have a console error...

Uncaught Error: cannot call methods on autocomplete prior to initialization; attempted to call method 'destroy'

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.431 seconds

Facebook Twitter LinkedIn