Simple request

12 years 3 months ago #189946 by recupart
Replied by recupart on topic Re: Simple request
I anderstand.
But my question is: how to do to make a automatic search with 5 fields?
The title speak about simple request because I think it's easy to make a request simply when all fields are ok in all of the profils.

Please Log in to join the conversation.

12 years 3 months ago - 12 years 3 months ago #189949 by recupart
Replied by recupart on topic Re: Simple request

krileon wrote: There is no automatic search, no idea what you're referring to for that. The query provided just adds the values of 5 fields together. You can adjust the query as necessary or create another one for different fields.


In fact I want to make some think like
select a.name,
(IF(a.cb_secteuractivitejecherche=$cb_jesuissecteuractivite,0.2,0)+
IF(a.cb_jecherchelangue1=$cb_langue1,0.1,0)+
IF(a.cb_jecherchelangue2=$cb_langue2,0.1,0)+
IF(a.cb_jecherchedepartement=$cb_jesuisdepartement,0.6,0)) 
as Affinity1,
(IF($cb_secteuractivitejecherche=a.cb_jesuissecteuractivite,0.2,0)+
IF($cb_jecherchelangue1=a.cb_langue1,0.1,0)+
IF($cb_jecherchelangue2=a.cb_langue2,0.1,0)+
IF($cb_jecherchedepartement=a.cb_jesuisdepartement,0.6,0)) 
as Affinity2 FROM #__comprofiler AS a

But it doesn't work

Please Log in to join the conversation.

12 years 3 months ago #189956 by krileon
Replied by krileon on topic Re: Simple request
You can't have multiple select outputs. You'll need to CONCAT them together into a single string. Your query also isn't valid, you're missing numerous ` and ' quotes.


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.

12 years 3 months ago - 12 years 3 months ago #189962 by recupart
Replied by recupart on topic Re: Simple request
Where are the mistake.
I'm sorry I'm a beginer.
Can I do
select a.name, (
   IF(a.cb_secteuractivitejecherche=$cb_jesuissecteuractivite,0.2,0) +
   IF(a.cb_jecherchelangue1=$cb_langue1,0.1,0) +
   IF(a.cb_jecherchelangue2=$cb_langue2,0.1,0) +
   IF(a.cb_jecherchedepartement=$cb_jesuisdepartement,0.6,0)) as Affinite1
   from #__comprofiler as a
Thank You.

Please Log in to join the conversation.

12 years 3 months ago - 12 years 3 months ago #190030 by krileon
Replied by krileon on topic Re: Simple request
The below might work; assuming those columns actually exist.
SELECT ( IF ( `cb_secteuractivitejecherche` = `cb_jesuissecteuractivite`, 0.2, 0 ) + IF ( `cb_jecherchelangue1` = `cb_langue1`, 0.1, 0 ) + IF ( `cb_jecherchelangue2` = `cb_langue2`, 0.1, 0 ) + IF ( `cb_jecherchedepartement` = `cb_jesuisdepartement`, 0.6, 0 ) ) FROM `#__comprofiler` WHERE `user_id` = '[user_id]'

Further information on writing database queries can be found at the below tutorial site.

www.w3schools.com/sql/default.asp


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.208 seconds