Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Banded Report Generator
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
alfaguru
Smarty n00b


Joined: 08 Nov 2006
Posts: 2

PostPosted: Wed Nov 08, 2006 11:55 am    Post subject: Very useful plugin ... but Reply with quote

This plugin does just what I want for a job - except that the requirement to pass an array means large reports fail with a memory error.

As I needed the problem fixed quickly I rewrote the plugin to do an SQL query instead, iteratively, but it would be cleaner if the recordset were to be an iterator object of some kind rather than an array.

The approach I'd use would be to still accept an array for backwards-compatibility but wrap it in an iterator object, otherwise expect an iterator. Eg:

Code:

if(is_array($recordset)) {
   $recordset = new report_array_iterator($recordset);
} elseif(!is_a($recordset, 'report_iterator')) {
   ... trigger error
}


A suitable iterator class, that can be subclassed to iterate over arrays or databases would need to be identified (or written, though I'd rather use one off the shelf).

Any thoughts?
_________________
Alfred Armstrong
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Nov 08, 2006 5:14 pm    Post subject: Reply with quote

@alfaguru: my rewrite (the one I touched on earlier that introduces a grouped recordset class) attempts to implement something along the lines you suggest. One problem, though, is that I want as much as possible for my class NOT to be responsible for retrieving data (but rather have it assigned). Another, more important issue, is that my class has to at least emulate grouping, sorting and statistics (assuming that an assigned raw dataset/iterator won't necessarily provide those in the records themselves).
Back to top
View user's profile Send private message
alfaguru
Smarty n00b


Joined: 08 Nov 2006
Posts: 2

PostPosted: Wed Nov 08, 2006 5:39 pm    Post subject: Reply with quote

Yes, sorting is a problem, potentially, but if you want to do a report on a large dataset you are going to have to sort it before reporting. And even when it doesn't need sorting, insisting on having the entire recordset as an array limits the usefulness of the plugin to whatever size of dataset will fit in the memory allowed by your host server (as I found).

Maybe it might be better to have two alternative parameter formats - one where you pass an iterator and the other where you pass an array? In the former the resort parameter can be ignored. If the data's already in the desired sequence, everything else should work with an iterator just as it does with an array. The code changes are pretty straightforward, certainly with the latest version I found on here. (Stats work fine).

I don't know exactly what your recordset class does, obviously, but surely it only requires random access when it has to sort the data? If the data's already sorted then sequential access is all that's needed. It doesn't seem a bad compromise to me to say that if someone wants to use the plugin with a large dataset, it has to be presorted and supplied via an iterator.

Anyhow, thanks again for the plugin. It saved me a fair amount of work even if I did have to fiddle with the code.
_________________
Alfred Armstrong
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Nov 08, 2006 6:24 pm    Post subject: Reply with quote

@alfaguru:perhaps it may be better yet to support multiple backends for the plugins. That way, if you intend to do your own data sorting and stats, then you would use an iterator based backend (presumably with our own sql handler) and otherwise you would use something like the grouped recordset class I have in mind. Just a thought.

At anyrate, before I implement the iterator idea I'll work on the basic class Smile

Thanks for the input!
Back to top
View user's profile Send private message
LoKi128
Smarty n00b


Joined: 18 Dec 2006
Posts: 3

PostPosted: Mon Dec 18, 2006 4:12 pm    Post subject: BRP, PHP 5.2 and Smarty 2.6.16 Reply with quote

Hey there!

I recently upgraded to PHP 5.2. I kept the same INI file, and upgraded to Smarty 2.6.16 along the way. A report I was using BRP stopped working, and it fails without any errors. There is just no output from display().

Turning on strict errors shows:
Strict Standards: Only variables should be passed by reference in D:\eis\smarty\templates_c\%%74^748^7485184E%%vt_abast_show.htm.php on line 5

Strict Standards: Only variables should be passed by reference in D:\eis\smarty\templates_c\%%74^748^7485184E%%vt_abast_show.htm.php on line 238

I don't think that is the problem, but here are the two lines referenced in the errors:

Code:

5: <?php $this->_tag_stack[] = array('report', array('recordset' => $this->_tpl_vars['data'],'record' => 'rec','groups' => 'modelcode')); smarty_block_report($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat=true);while ($_block_repeat) { ob_start(); ?>

238: <?php $_block_content = ob_get_contents(); ob_end_clean(); echo smarty_block_report($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat=false); }  array_pop($this->_tag_stack); ?>


Thank you very much for the code which has helped me greatly, and I hope we can fix this soon!
Back to top
View user's profile Send private message
LoKi128
Smarty n00b


Joined: 18 Dec 2006
Posts: 3

PostPosted: Thu Dec 28, 2006 8:47 pm    Post subject: Reply with quote

*BUMP*
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Dec 28, 2006 11:17 pm    Post subject: Reply with quote

LoKi128 wrote:
*BUMP*


Did you get it to work? I haven't looked at it.
Back to top
View user's profile Send private message
LoKi128
Smarty n00b


Joined: 18 Dec 2006
Posts: 3

PostPosted: Wed Feb 07, 2007 3:03 pm    Post subject: Reply with quote

Well... feeling pretty stupid. I finally had some time to go back to this problem, and the solution was simply to erase the cache contents.

Good code man. Thanks again!
Back to top
View user's profile Send private message
sangprabv
Smarty Rookie


Joined: 14 Feb 2005
Posts: 13
Location: Jakarta

PostPosted: Fri Apr 18, 2008 9:05 am    Post subject: Need help Reply with quote

Guys,
Im trying to present a report with this kind of output:

--------Web A---------Web B
Date in out total in out total GRAND TOTAL


My first problem is the date column, I can't figure out how to print per date per line, When I run the script. It always return this on every line:
01-01-1999 24 <-- in
01-01-1999 26 <-- out
01-01-1999 50 <-- total

Please help, many thanks and tia
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
thefox149
Smarty n00b


Joined: 09 Jan 2008
Posts: 2

PostPosted: Thu May 15, 2008 3:29 am    Post subject: Reply with quote

I use this plugin quite regularly. I want to help but you need to post more code to better understand what you are trying to acheive
Back to top
View user's profile Send private message
sangprabv
Smarty Rookie


Joined: 14 Feb 2005
Posts: 13
Location: Jakarta

PostPosted: Thu May 15, 2008 10:25 am    Post subject: Reply with quote

Hi,
Thanks for the reply. Please see the screen captured. http://www.binbit.co.id/screenshot.png Maybe it will help. TIA
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
rneissl
Smarty n00b


Joined: 15 Jul 2011
Posts: 2

PostPosted: Fri Jul 15, 2011 1:01 pm    Post subject: banded report generator with Smarty 3.x Reply with quote

Hi,
has somewone portet banded report generator to smarty 3.x?
Back to top
View user's profile Send private message
rneissl
Smarty n00b


Joined: 15 Jul 2011
Posts: 2

PostPosted: Fri Aug 09, 2013 7:02 am    Post subject: Banded Report Generator for Smarty 3.x Reply with quote

we really need banded report generator an smarty 3. our company would pay for the port, if neccesssary.
Back to top
View user's profile Send private message
johnsmitt
Smarty n00b


Joined: 22 Nov 2013
Posts: 2

PostPosted: Fri Nov 22, 2013 5:58 pm    Post subject: Reply with quote

Is it working in Smarty 3?

Thanks
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Nov 23, 2013 11:36 am    Post subject: Reply with quote

For Smarty 3 in all plugins $smarty->trigger_error(....) has to replaced with trigger_error(...).

But the example does throw another error. I currently had no time to check if this was related to Smarty3 or not.
I will look into it later.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 6 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP