[SOLVED] Calculation of the redundancy of a field

12 years 7 months ago - 12 years 7 months ago #176255 by Arzor
Hi all,

I'm a french webmaster and I'm using CB 1.7 with the plugin cb_conditional in Joomla 1.5.23

I would like to add a conditional field that calculation the number of times the same value appear in a profil.

Here is an exemple:

Tab 1:

License 1, Group: Visu, Site name: Paris, ...
License 2, Group: Admin, Site name: Lorient, ...
License 3, Group: Visu, Site name: Marseille, ...

Tab 2 (this tab is in fact a summary):

Number of license type Visu : 2
Number of license type Admin : 1


Can I do that with cb_conditional ? or an other plugin ?

Thank's,
Best regards,
Arzor

Please Log in to join the conversation.

12 years 7 months ago #176286 by krileon
Replied by krileon on topic Re: Calculation of the redundancy of a field
CB Conditional is strictly for field/tab display based off field value. For example show Field A if Field B = Bob. It does not calculations like you're wanting. I believe you could use incubator project CB Query Field however and using a database SELECT query with this field perform your calculation.


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 7 months ago - 12 years 7 months ago #176578 by Arzor
Ok, I understand, but I have a problem.

If I use a SELECT query, the value in my 'calculation' field will be an addition of the specified value for the whole user in the table 'jos_comprofiler'...

So with this solution, I believe I can't isolate the value for just one user. Or not?

Please Log in to join the conversation.

12 years 7 months ago #176598 by krileon
Replied by krileon on topic Re: Calculation of the redundancy of a field

So with this solution, I believe I can't isolate the value for just one user. Or not?

You'd need to specify a WHERE in your query to `id` = [user_id].


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 7 months ago #176621 by Arzor
So I try this but It doesn't work:

UPDATE TABLE jos_comprofiler SET cb_typearchivage =
(SELECT COUNT (*) FROM jos_comprofiler WHERE cb_groupe1 = 'Archiv.' AND cb_groupe2 = 'Archiv.'AND 'cb_groupe3 = 'Archiv.' AND 'id'= [69])
WHERE 'id' = [69]

Thank's

Please Log in to join the conversation.

12 years 7 months ago #176631 by krileon
Replied by krileon on topic Re: Calculation of the redundancy of a field
Why would you be doing an update? As I've explained the CB Query Field is specifically for performing SELECT queries and nothing more. Please see the below query as should do the trick.
SELECT ( IF( `cb_groupe1` = 'Archiv', 1, 0 ) + IF( `cb_groupe2` = 'Archiv', 1, 0 ) + IF( `cb_groupe3` = 'Archiv', 1, 0 ) ) FROM `#__comprofiler` WHERE `id` = [user_id]


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.
The following user(s) said Thank You: Arzor

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.179 seconds

Facebook Twitter LinkedIn