This topic is locked

Display Count

8/12/2009 9:02:51 AM
PHPRunner General questions
T
thomaske author

Hi All,

I've created a report that counts all the members of a particular business. Now that I have the count, I like to be able to place it somewhere on my report with a brief description like "Total number of members" then show the count. Is this possible and if so how would I do it.
Thanks

Tomas

J
Jane 8/13/2009

Tomas,
use custom events (Insert PHP code snippet option on the Visual Editor tab) for this purpose.

T
thomaske author 8/14/2009

Tomas,

use custom events (Insert PHP code snippet option on the Visual Editor tab) for this purpose.


Thanks for the help Jane. I understand the concept of what you're saying to do but I have no PHP experience and will not be able to execute it.
Tomas

J
Jane 8/17/2009

Tomas,
you can publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with detailed description of what you want to achieve. I'll try to help yo with sample code.

T
thomaske author 8/19/2009

Tomas,

you can publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with detailed description of what you want to achieve. I'll try to help yo with sample code.


Thanks for all your help Jane. I'm in the process of publishing my project as you suggested on the Demo Account but on my Finish page I don't have a Demo Account button. I'm running PHPRunner 5.0 (Build 766).
Tomas

J
Jane 8/20/2009
J
jsuisman 8/24/2009

Tomas,
Not sure if you have this done yet...but
1 In visual editor page put the cursor where you want the count number to go
2 At the top of the screen there is a button that when you mouseover should say "Insert PHP code snippet". It's a white page with a green pencil. Click it
3 In the box that pops up, change the name to something meaningful to you. Delete everything in the white part of the box and paste this code.(after you customize to your table names and field names)
note -- This is MySQL format



global $conn;

$strSQL = "SELECT count(field_you_want_counted) as 'count'

FROM your_database.`your_table`

WHERE whatever_conditions_here";

$rsExists = db_query($strSQL,$conn);

$data=db_fetch_array($rsExists);

echo $data['count'];



4. Click OK
In the visual editor it will show a yellow box with the name of your event, and when you run the page the count should show up in place of it.
Let me know if it works.
Jarred

T
thomaske author 8/31/2009



Tomas,
Not sure if you have this done yet...but
1 In visual editor page put the cursor where you want the count number to go
2 At the top of the screen there is a button that when you mouseover should say "Insert PHP code snippet". It's a white page with a green pencil. Click it
3 In the box that pops up, change the name to something meaningful to you. Delete everything in the white part of the box and paste this code.(after you customize to your table names and field names)
note -- This is MySQL format



global $conn;

$strSQL = "SELECT count(field_you_want_counted) as 'count'

FROM your_database.`your_table`

WHERE whatever_conditions_here";

$rsExists = db_query($strSQL,$conn);

$data=db_fetch_array($rsExists);

echo $data['count'];



4. Click OK
In the visual editor it will show a yellow box with the name of your event, and when you run the page the count should show up in place of it.
Let me know if it works.
Jarred

T
thomaske author 8/31/2009

Jarred,

Thanks for your help in trying to find a solution to display a count on a report page. I've tried to used your code but couldn't get it to work for me. Below is how I customized it:
global $conn;

$strSQL = "SELECT count(AD_MEMBER)

FROM WRRN.CAS_BUS_MEMBER_ASSIGNMENT_VIEW";

$rsExists = db_query($strSQL,$conn);

$data=db_fetch_array($rsExists);

echo $data[count()];
There were no errors with this but also no count displayed either. I tried using the as 'count' with the echo $data['count'] but I kept getting a ORA-00923: FROM keyword not found where expected error.
Also, I have the count already, I just can't seem to display it on my report page.
Thanks again,

Tomas