CB Query - need push in right direction please

7 years 2 months ago #291652 by 3cellhosting
Hello Support,

CB Query add-on has changed hugely since I first used it several years ago. That is a good thing.

My knowledge of mySQL and CB Query hasn't changed much. That is a bad thing!

I have GeoFactory 5 map and CB gateway and we have a sort issue. Cedric has no immediate solution other than to use a different field as the first field in the template for the map bubble. So here is my dilemma...

I want to create a field in each profile that self populates based on concatenation so that each record updates the cb_mapsort field based on the cb_discpline field. I have watched the videos, trawled the forums and am completely lost, more confused than when I started.

For example if a record has cb_lodgenumber = 39 and cb_discipline = 'craft' then I want cb_mapsort to populate itself with cb_lodgenumber. However, if the details are cb_lodgenumber = 39 and cb_discipline = 'chapter' then I want cb_mapsort to populate itself with 'C'+'cb_lodgenumber'

This way we can add cb_mapsort as the main field to drive the sort on the fly but use css to hide display.

We need to display each record based on all craft lodgenumbers first (in sequence lowest to highest) and then all chapter lodgenumbers (lowest to highest). The lodgenumber field is not unique and there are often duplicates, but not always.

I hope this makes sense.

Regards

David

David
www.3cellhosting.com - where personality, creativity and integrity come as standard.

Please Log in to join the conversation.

7 years 2 months ago #291669 by krileon
Does your field have to be stored in the database? A CB Query field is not stored so it won't help you in this regard. You'd have to use CB Auto Actions and a Field action acting after profile update and likely registration if you need the value stored. If you don't need it stored then your conditions are pretty basic and wouldn't waste SQL time to compile that, but instead a Custom HTML field with substitutions will work as follows.

[cb:if cb_lodgenumber="39" and cb_discipline="craft"][cb_lodgenumber][/cb:if]
[cb:if cb_lodgenumber="39" and cb_discipline="chapter"]C[cb_lodgenumber][/cb:if]

It sounds like you need it stored, but for sorting where? If a userlist then it could just be a part of the advanced sorting usage.


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.

7 years 2 months ago #291674 by 3cellhosting
Replied by 3cellhosting on topic CB Query - need push in right direction please
Hi Krileon,

Thanks for the info that CB Query doesn't store anything. It is stuff like that I need to get my head around.

As a test I did a quick query directly on database and filled the new field to test that it would actually work on the GeoFactory map via the CB Gateway.

The new field content does now sort in correct order by setting map to use cb_mapsort as main sort field.

I like the idea of substitution but I don't think that would work as we need the field to exist. Fortunately it appears we do not add many new Lodges, perhaps one every 5 years or so, therefore it won't be an issue going forward, as we can manually populate the field.

Thanks for the prompt reply and the alternatives. Much appreciated.

David

David
www.3cellhosting.com - where personality, creativity and integrity come as standard.

Please Log in to join the conversation.

7 years 2 months ago #291675 by krileon
I've no idea how GeoFactory is doing all of that so I don't know what to suggest. My guess is they're just querying _comprofiler directly so you'll indeed need a stored value, which will require using CB Auto Actions to update the stored field as needed. It would be better if GeoFactory let you sort by more than 1 field as that likely would solve your issue so sort by cb_discipline then by cb_lodgenumber or if it let you specify more customized sorting.


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.

Moderators: beatnantkrileon
Time to create page: 0.204 seconds

Facebook Twitter LinkedIn