[SOLVED] Substitution. update cb field based on other table

13 years 1 month ago - 13 years 1 month ago #157008 by ignatius2
Hi

I am trying to update a custom CB field (cb_owner) by pulling data from a reference table and based on the content of another custom CB field (cb_account_number).

I know that I can do this via the "CB Queries" plug-in. The query would run immediately after the table is saved.

I tried this substitution query, but this does not seem to work.
SELECT `owner` FROM `fab_owner` WHERE `cb_account_number` = `fab_owner___account_number`
The table name is fab_owner
fab_owner___account_number
fab_owner___owner

The reference table has a few hundred records, and the reference field is not an index field. Is this going to work?

Thanks

Please Log in to join the conversation.

13 years 1 month ago #157196 by krileon
The query looks invalid, please try the below. It is also just a select query.
UPDATE `#__comprofiler` SET `cb_owner` = ( SELECT `owner` FROM `#__fab_owner` WHERE `account_number` = '[cb_account_number]' ) 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.

13 years 1 month ago #157250 by ignatius2
Thanks again Kyle,

It works. You are a genius.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.157 seconds

Facebook Twitter LinkedIn