Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] How to have a list of Database field listed for a User

9 years 1 month ago - 9 years 3 weeks ago #271302 by smalldragoon
Hi,
I tried to be as generic as possible in the subject ...
My need is to be able to display a "bank statement" like table with :
- a Date
- a Description
- an amount

I tried with the query field but it only allow me to select one column , thus displays values in one line separated with ","

Any idea on how I can have somehting done with one of the Joomla addon ?

I checked the Blog Addon but it is not working ( installed latest version of core and addon not compatible )
Thx !
Last edit: 9 years 3 weeks ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 month ago - 9 years 1 month ago #271310 by krileon
CB Query Field or a custom plugin is your only solutions. CB Query Field doesn't have a column or row limit. You can display as many as you want. You'll need to configure it as follows to have multi-row and multi-column usage.

Output: Multiple Rows
Header:
Code:
<table class="table table-hover table-responsive"> <thead> <tr> <th>Date</th> <th>Description</th> <th>Amount</th> </tr> </thead> <tbody>
Row:
Code:
<tr> <td>[column_date]</td> <td>[column_description]</td> <td>[column_amount]</td> </tr>
Footer:
Code:
</tbody> </table>

As I do not know your database structure the above is just an example to get started. Please read the parameter descriptions carefully for further usage.


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.
Last edit: 9 years 1 month ago by krileon.

Please Log in or Create an account to join the conversation.

9 years 1 month ago #271332 by smalldragoon
Hello Kyle !
Thanks for your hepl and reply.
I searched and do not find where I can configure the header, row and footer.
to give you more info , here is my SQL :

SELECT stDate,stdescrip,StAmount,userID
FROM `mybank_transactions`
LIMIT 0 , 30

An additional question is how can I only select rows related to my current user ? ( referenced by the UsedID ). I know how to grab it in PHP : $cbUser->getField('id', null, 'csv', 'none', 'list' ) or $user->name directly... but how can I have it as parameter in my sql statement ?
I have checked and I have all the latest version of all module, plugin etc...
Thx !!!

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 month ago #271360 by krileon

I searched and do not find where I can configure the header, row and footer.

It's under Parameters > Display of your Query fieldtype.

An additional question is how can I only select rows related to my current user ? ( referenced by the UsedID ). I know how to grab it in PHP : $cbUser->getField('id', null, 'csv', 'none', 'list' ) or $user->name directly... but how can I have it as parameter in my sql statement ?

The query supports substitutions so you'd just substitute it in. Example as follows based off the query you've provided.

Code:
SELECT `stDate`, `stdescrip`, `StAmount` FROM `mybank_transactions` WHERE `userID` = '[user_id]' LIMIT 0, 30


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 or Create an account to join the conversation.

9 years 4 weeks ago - 9 years 4 weeks ago #271366 by smalldragoon
that's what I though but under display as drop-down list I have :

-separated with Coma ( no new field appears )
-unnumbered list "ul" ( CSS clas of the list field appears)
-ordered list "ol" ( CSS clas of the list field appears)
I don't have the 3 "panes" like you have ?

[ Edit ]
BTW, using Parameter which works great for SQL, looks that there is an isue in PHP cdeo from CB ?

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method cbQueryFieldClass::escapeSQL() should not be called statically in /home/XXXXXXXXX/public_html/libraries/CBLib/CB/Legacy/CBuser.php on line 1041

Thx
Last edit: 9 years 4 weeks ago by smalldragoon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 4 weeks ago - 9 years 4 weeks ago #271408 by krileon
You need to create a field of the type Query. If you don't have the fieldtype available then CB Query Field isn't installed. If CB Query Field is installed then ensure it's up to date according to the chart below.

www.joomlapolis.com/cb-20-addon-status


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.
Last edit: 9 years 4 weeks ago by krileon.
The following user(s) said Thank You: smalldragoon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum