Query field

10 years 3 months ago - 10 years 3 months ago #239686 by wavi
Query field was created by wavi
If any can ..a little help :

I want populate a tx field of CB from other field inside same database

(create a field query for each text field like populate ex ZIP )


i use this query

SELECT `value` FROM `ogkjt_jblance_custom_field_value` WHERE `fieldid` = '9'

work ..but this populate the same value for all user, i like any user have the appropriate value

better explain here the query i need :

The X Field of all User (like ZIP and is different from user to user) ) registered with Joombri

populate the X Field of all Same User with same value in Community Builder for each user

With a query posted , yes populate the field but is the same field for all user example

User A populate with zip 111111
User B populate with zip 111111
User C populate with zip 111111

i want the realy value for each user like

User A populate with zip 111111
User B populate with zip 222222
User C populate with zip 333333


any suggestion for complete code at this query to import value from user

Thankyou+

Also found this on post forum ..but no work (also ext. is the same)

SELECT category
FROM sgj_jblance_user, sgj_jblance_category, sgj_users
WHERE sgj_jblance_category.id=sgj_jblance_user.id_category AND '[user_id]'=sgj_jblance_user.user_id

Please Log in to join the conversation.

10 years 3 months ago #239699 by krileon
Replied by krileon on topic Query field
Your query needs to be more specific if you want it to be unique on a user by user basis. Ideally your table should have a user_id column, which you can condition against. I can't help you with your query as I have no idea how your database is structured, sorry. An example of a more unique query is as follows.

SELECT `email` FROM `#__users` 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.

Please Log in to join the conversation.

10 years 3 months ago #239838 by wavi
Replied by wavi on topic Query field
found this query (from a forum post) i have tested on my site and work (display exact value for each user) :

SELECT category
FROM sgj_jblance_user, sgj_jblance_category, sgj_users
WHERE sgj_jblance_category.id=sgj_jblance_user.id_category AND '[user_id]'=sgj_jblance_user.user_id


I'm not able replicate this query for a my single field custom at Joombri eaxmple
Have in joombri the customer JOLIE with fields called zip is 1111
i want a db query for insert in Community builder the zip 1111 for the user JOLIE in Community builder.
(note i have the customer JOLIE in Jombri and also in CB )

Krileon can help with this?

Attach you table-database (db is a same of CB) joombri with a field like query/field/import

thank you+
Attachments:

Please Log in to join the conversation.

10 years 3 months ago #239842 by krileon
Replied by krileon on topic Query field
CB Query Field pulls values from the database. It's not designed to insert anything. It just does a select query then outputs the results as a field. Please see my previous reply as I've already provided you a working example. Another example as follows based off the query you supplied.

SELECT c.`category`
FROM `#__jblance_user` AS u
LEFT JOIN `#__jblance_category` AS c
ON c.`id` = u.`id_category`
WHERE u.`user_id` = '[user_id]'

Please note the above is provided as is based off your example. It has in no way been tested. Please be sure to test and adjust as needed.


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