Skip to Content Skip to Menu

[SOLVED] CB Query Field: Country. Need help to make it filter by Country instead of iso

  • danpoole
  • danpoole
  • OFFLINE
  • Posts: 49
  • Thanks: 6
  • Karma: 0
4 years 11 months ago - 4 years 9 months ago #315603 by danpoole
Hi

I have been trying to make my list that contains my field cb_countryinfo display alphabetically by country name but it keeps sorting by iso. I currently have the query set to the one similar to the Documentation : SELECT `iso`, `country`, `continent_full` FROM `q74gf_country_info` ORDER BY `country` with the options set to Value = iso and Label Column = country. When I try making the Value = country the field would disappear from my front end of the site with no change in how my list is sorted. The list is sorted by the field cb_countryinfo Ascending.

To see the list, here is a link to the front of the site. www.emmett-technique-hq.com/practitioners/other-countrieshttps://www.emmett-technique-hq.com/practitioners/other-countries
As can be seen if you view the site it goes Austria then Canada then Switzerland.
Which codes is AT, CA, CH

Could I please get an answer or a nudge in the right direction?
Using Community Builder: 2.4.1 and CB Query Field: 5.0.4

Thanks
Last edit: 4 years 9 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 11 months ago - 4 years 11 months ago #315625 by krileon
The order is entirely determined by your query. So "ORDER BY `country` ASC" or "ORDER BY `country` DESC" should work as you'd expect. This of course only applies to that query select field. Since you're storing ISO and sorting by the stored value in your userlist it's going to sort by ISO. Your only option is to either store `country` or add a subquery to the ORDER BY of your userlist by using Advanced sorting more.

CB Query Field: 5.0.4

Please note the version you are using is over a year old.


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.
Last edit: 4 years 11 months ago by krileon.

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

  • danpoole
  • danpoole
  • OFFLINE
  • Posts: 49
  • Thanks: 6
  • Karma: 0
4 years 11 months ago #315634 by danpoole
Thanks Krileon

I have tried changing the query to SELECT `country`, `continent_full` FROM `q74gf_country_info` ORDER BY `country` making the Value = country as well as the label = country, it removes the country field from the front end and ordering doesn't change. I have attached 2 images showing the difference. Otherwise how would I be able to do the subquery as I attempted before with no success

Attachments:

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

  • Astrid
  • Astrid
  • OFFLINE
  • Posts: 183
  • Thanks: 68
  • Karma: 10
4 years 11 months ago #315643 by Astrid
Advanced:
Code:
ue.`cb_countryinfo` ASC

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 11 months ago #315654 by krileon

I have tried changing the query to SELECT `country`, `continent_full` FROM `q74gf_country_info` ORDER BY `country` making the Value = country as well as the label = country, it removes the country field from the front end and ordering doesn't change. I have attached 2 images showing the difference. Otherwise how would I be able to do the subquery as I attempted before with no success

You can't change the value the field stores and expect it to dynamically update every user row to the new values. That's just not how it works. For your change to take affect you need to re-save all those profiles with country re-selected. Your alternative is to use a subquery in the ORDER BY of the userlist query, which is done by setting the ordering to Advanced to supplying the necessary SQL.


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.

  • danpoole
  • danpoole
  • OFFLINE
  • Posts: 49
  • Thanks: 6
  • Karma: 0
4 years 10 months ago - 4 years 10 months ago #316210 by danpoole

For your change to take affect you need to re-save all those profiles with country re-selected. Your alternative is to use a subquery in the ORDER BY of the userlist query, which is done by setting the ordering to Advanced to supplying the necessary SQL.


As I have such a big database, re-saving all the profiles is not feasible. I have tried doing SQL in the Advanced normally and with the information provided by your help documents but with no success. I don't seem to understand the correct formatting in which to do the sub query in the ORDER BY query for my list. Would you please be able to provide an example on how to do the sub query.
Last edit: 4 years 10 months ago by danpoole.

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

Moderators: beatnantkrileon
Powered by Kunena Forum