[SOLVED] output query in list

8 years 3 months ago - 8 years 3 months ago #276604 by activha
[SOLVED] output query in list was created by activha
Hello

We use a query field with following query ::
SELECT DATE_FORMAT( `time_completed_date`,'%d %b %Y')   FROM `yq0g1_cbsubs_payment_baskets` WHERE  `payment_status` = 'Completed' AND `user_id`  = '[USER_ID]'

and an output as multiple columns/rows such as :
[column_time_completed_date]

However, display in lists is only :
[column_time_completed_date]
[column_time_completed_date]
[column_time_completed_date]

when there is 3 row for instance.

Can you tell me what I missed ?

Thanks

Please Log in to join the conversation.

8 years 3 months ago #276614 by krileon
Replied by krileon on topic output query in list
You have no column time_completed_date in your select query. It's actually going to come out as "DATE_FORMAT( `time_completed_date`,'%d %b %Y')" being the column. By adding an AS to it though you can fix that. Example as follows.

SELECT DATE_FORMAT( `time_completed_date`, '%d %b %Y' ) AS time_completed_date_formatted FROM `#__cbsubs_payment_baskets` WHERE `payment_status` = 'Completed' AND `user_id`  = '[user_id]'

You should then be able to use the below.

[column_time_completed_date_formatted]


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.

8 years 3 months ago #276617 by activha
Replied by activha on topic output query in list
No, same result and output with AS

For now can we use this to get the most recent date ?
SELECT DATE_FORMAT(MAX( `time_completed_date`),'%d %b %Y') AS `time_completed_date_formatted` FROM `yq0g1_cbsubs_payment_baskets` WHERE  `payment_status` = 'Completed' AND `user_id`  = '[USER_ID]'

But there is probably a little bug somewhere with no standard queries in the plugin

Please Log in to join the conversation.

8 years 3 months ago #276622 by krileon
Replied by krileon on topic output query in list
Seams to work fine in my tests using the below.

Query:
SELECT DATE_FORMAT( `time_completed_date`, '%d %b %Y' ) AS time_completed_date_formatted FROM `#__cbsubs_payment_baskets` WHERE `user_id`  = '[user_id]'
Output: Multiple Rows
Row:
<div>[column_time_completed_date_formatted]</div>

I removed the status check for testing purposes and outputs fine as follows.

21 Oct 2015
18 Jan 2016


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.

8 years 3 months ago #276663 by activha
Replied by activha on topic output query in list
Right there was a typo thanks for the help :-)

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.264 seconds

Facebook Twitter LinkedIn