Query field value substitution with another user id

4 years 1 month ago #316929 by activha
Hello

I follow on this post Custom fields with a specific question that could apply to all query fields.

We have this query :
SELECT e.* FROM `#__groupjive_plugin_events` AS e JOIN `#__groupjive_plugin_events_attendance` AS a on a.`user_id` = '[user_id]' AND a.`event` = e.`id` JOIN `#__groupjive_groups` AS b ON  b.`id` = e.`group` AND ( b.`category` = '13'  OR b.`id` = '56' )

And for the value in the layout field we would like to display a field from the user id selected in the query, ie user_id of the event owner like
[value] [cb:userdata field="cb_marketing_multiplier" user="user_id" /]

Of course this does not work, because it's getting the id of the viewing user and not the owner of the selected row.

Would it be possible to add a layout to the value column so that we can extract data from the row, ie the owner user id in this case ?
Or do you see another solution ?

Thanks in advance

Please Log in to join the conversation.

4 years 1 month ago #316938 by krileon
Nested raw substitutions are planned in a future release. They're actually implemented already, but the MR is pending review and merge. Don't know if it'll solve your issue though. It'll allow for cases like the following.

[cb:userdata field="FIELD_NAME" user="[FIELD_NAME]" /]

It will not be able to pull values out of your query that it has no knowledge of.


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.

4 years 1 month ago #316941 by activha

It will not be able to pull values out of your query that it has no knowledge of.


user_id in this case is only a table field of the selected row from the query.
My intent was to have a queried value that could be displayed combined with another element of the query, like you do for label substitution and group substitution.
Could you add it in the parameters options ? as custom value for instance ?

Please Log in to join the conversation.

4 years 1 month ago #316949 by krileon
No, that will not be supported. The layout has no clue any of that even exists. All the layout is given is the value of the field and nothing more. If it's a regular query field then you'd be able to do something like the following when nested substitutions is released.

[cb:userdata field="FIELD_NAME" user="[column_COLUMN_NAME]" /]

Nested substitutions only allow for raw substitutions and since column substitutions are added as raw substitutions and sent to substitutions parsing they can be nested. For a Query Select you should just be outputting whatever information you need already as part of the label column.


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: activha

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.181 seconds

Facebook Twitter LinkedIn