Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Very Simple Report Generator (Use QTF format)
Re: Very Simple Report Generator (Use QTF format) [message #24187 is a reply to message #24140] Sun, 03 January 2010 23:09 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Sergey,

I finally have a working example that manages the following points:

* Header/body/footer management
* nesting anywhere and with no limitations (you nest/nest/nest ...)
* body looping is managed outside the user code
==> The user code is therefore greatly simplified
* text replacement is managed automatically even when when a part
is separated into several parts due to nesting
==> all you have to do is reference the text replacements you
want to do and they will be done
In order to help the coding of the user code, an annotated template can be generated:
It is annotated with the context information (see example below).

The code isn't finished so there are some restrictions for the moment:
* no table (row adding)management
* bad management of bullets (line adding)


The tags used are the following:
##H : Section start (and HEADER start)
##B : Section part BODY start (and also end of HEADER)
##F : Section part FOOTER start (and also end of HEADER or BODY)
##E : Section END (and also end of previous section part)

##H and ##E MUST BE present, the other two are optional !

Here is a screen-shot of the example application

index.php?t=getfile&id=2093&private=0

[Updated on: Mon, 04 January 2010 11:38]

Report message to a moderator

Re: Very Simple Report Generator (Use QTF format) [message #24188 is a reply to message #24187] Sun, 03 January 2010 23:26 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Here is the code:

It is composed of two packages:
* ReportGenerator: the library code
* ReportGeneratorTest: a test example

They are both intended to be put in bazaar.

To compile the library you must have BOOST_1.41 and the path to it must be configured in the ReportGenerator package.
I used boost::spirit to do the parsing. For me it's much more readable than regular expressions Wink

The current version of the code mixes std::string and Upp::String and some cleaning must be done.
The code is also not optimized for performance.

The code can be easily modified to support wide strings (in theory, I haven't tried yet Rolling Eyes )

Let me know what you think about it Sergey Question .

EDIT: removed attached file ==> see more recent post

[Updated on: Mon, 11 January 2010 23:55]

Report message to a moderator

Re: Very Simple Report Generator (Use QTF format) [message #24196 is a reply to message #24188] Mon, 04 January 2010 12:29 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Didier!. I looked at your code. It seemed to me that you're too complicated. Of course there may be problems which need such a decision.

I set the goal for their generators are somewhat different:
- Transparency and simplicity of the client code,
- Transparency and understandability document template,
- NOT a universal code for different types of reports
(the scheme and the availability of data groups and totals should be set in the client code, but not in the template)

It is necessary for very simple printed forms (documents, calculations, etc.)

I think that for a little more complex forms of documents, this scheme is not suitable.

I think that the QTF format is not designed for storing various information such as schema report, and it would be better to make some QTR format in which to store templates of the report, data schemas and calculation schemes.

To implement the format QTR (in contrast to the QTF) need a template editor and editor of data schemas. This is a problem. May need to take a closer look in the direction RichPara.

As for my version, the next step I plan to make a store QTF templates in SQL database, and a set of controls for easy embedding in the application of a simple reports system.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Very Simple Report Generator (Use QTF format) [message #24200 is a reply to message #24196] Mon, 04 January 2010 14:22 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Thank's for looking my version of Report Generator.

sergeynikitin wrote on Mon, 04 January 2010 12:29

Didier!. I looked at your code. It seemed to me that you're too complicated. Of course there may be problems which need such a decision.



My example is more complicated only because I added nested groups with header/body/footer
and because my template document is completely filled with TAGs and replacement vars (not a lot of real text to catch on to)

Quote:


I set the goal for their generators are somewhat different:
- Transparency and simplicity of the client code,
- Transparency and understandability document template,
- NOT a universal code for different types of reports
(the scheme and the availability of data groups and totals should be set in the client code, but not in the template)


If the user code manages all the groups and body repetition, the user code will drag in unnecessary complexity. for ex. managing repetition is always necessary so why not doing it once for all ?

Quote:


It is necessary for very simple printed forms (documents, calculations, etc.)


Nesting comes in handy very quickly, and to be honest I need it for my spearfishing app (to print out competition results).

Quote:


I think that for a little more complex forms of documents, this scheme is not suitable.

I think that the QTF format is not designed for storing various information such as schema report, and it would be better to make some QTR format in which to store templates of the report, data schemas and calculation schemes.

To implement the format QTR (in contrast to the QTF) need a template editor and editor of data schemas. This is a problem. May need to take a closer look in the direction RichPara.



Yes I agree. But this way is the long way and it will take a lot of time to go!


Quote:


As for my version, the next step I plan to make a store QTF templates in SQL database, and a set of controls for easy embedding in the application of a simple reports system.


Great !

On my side I'm gonna push in tables and bullets so that it can be usable for almost anything.
At least it will be available while waiting for a better and more complete solution.
( Until now I was generating reports by using RichText or by assembling QTF strings, so when I wanted to change a color or the global appearance it was not easy. And the user code, in this case was VERY complicated !! )





Re: Very Simple Report Generator (Use QTF format) [message #24233 is a reply to message #24196] Wed, 06 January 2010 20:56 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Mon, 04 January 2010 12:29


As for my version, the next step I plan to make a store QTF templates in SQL database, and a set of controls for easy embedding in the application of a simple reports system.


Hello Sergey,

today I tested your package. I like it, simple ed effective, just what I was looking for. In this way I can generate the badges of my tournament. I already print it with fixed dimensions but now I can change them.

Just let me advance a suggestion. It would be nice if the image size can be set in the report. For example:
##IMAGE_1600_800
in the report would mean resize all the image at 1600x800. Then the callback take the picture and whatever its size is let it to become 1600x800.
At the moment it is set in the code, but would be very andy to have it in the report.

Bolshoie spasibo!
Luigi
Re: Very Simple Report Generator (Use QTF format) [message #24243 is a reply to message #24233] Thu, 07 January 2010 05:49 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

No problem! That's all you can do in the Callbacks.

The idea is interesting, I'll try to think how this can be done more beautifully and transparently.

Perhaps the introduction of parameters will be the best.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Very Simple Report Generator (Use QTF format) [message #24283 is a reply to message #24243] Fri, 08 January 2010 17:53 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Hello Luigi!

And why not make some IMAGEs, for example IMAGE_1, IMAGE_2, IMAGE_3. Or for example IMAGE_TINY, IMAGE_SMALL, IMAGE_MEDIUM, IMAGE_LARGE, IMAGE_XXL and so on. I think this is fundamentally solve the problem. To do this, Callback, we simply declare the different challenges PlaceImage with different sizes.

The only flexible way, which I see is the definition of additional methods
- SubstVar1 (SubstVar with one parameter)
- SubstVar2 (SubstVar with two parameters)
- SubstVar3 (SubstVar with three parameters)
and
- PlaceImage1 (SubstVar with one parameter)
- PlaceImage2 (SubstVar with two parameters)
- PlaceImage3 (SubstVar with three parameters)

But this is still only plans.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Very Simple Report Generator (Use QTF format) [message #24288 is a reply to message #24283] Fri, 08 January 2010 20:04 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Fri, 08 January 2010 17:53

Hello Luigi!

And why not make some IMAGEs, for example IMAGE_1, IMAGE_2, IMAGE_3. Or for example IMAGE_TINY, IMAGE_SMALL, IMAGE_MEDIUM, IMAGE_LARGE, IMAGE_XXL and so on. I think this is fundamentally solve the problem. To do this, Callback, we simply declare the different challenges PlaceImage with different sizes.

The only flexible way, which I see is the definition of additional methods
- SubstVar1 (SubstVar with one parameter)
- SubstVar2 (SubstVar with two parameters)
- SubstVar3 (SubstVar with three parameters)
and
- PlaceImage1 (SubstVar with one parameter)
- PlaceImage2 (SubstVar with two parameters)
- PlaceImage3 (SubstVar with three parameters)

But this is still only plans.


Hello Sergey,

I like the idea of IMAGE_TINY, IMAGE_SMALL, ecc... Perhaps these sizes can be hardcoded by #define and the coder can set them according the purpose of his program.

Luigi
Re: Very Simple Report Generator (Use QTF format) [message #24351 is a reply to message #24288] Mon, 11 January 2010 23:53 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi,

I've updated my ReportGenerator to add Image support.
While playing around with it for my own usage I noticed that Tables and bullets where already supported.

So the current status of report generation from a QTF template is the following:
  • Table support (table header is mandatory though)
  • Bullet support
  • Image support
  • Header/body/footer supported
  • Nesting (as much as you want)
  • Sequencing ==> combined with nesting, it allows very complex templates
  • Helper function that generates an annotated QTF template that makes creating user code easy


I plan to add attributes (for format, image size or anything else) to replacement text using something like:
TEXT%%attributes%% ( I'm not fixed yet )

And then I think it will the end.


I have also updated
  • The test example to add table/bullet/images and a view where you can see 3 different reports made with the same user code and different templates
  • The report generator code for image support and better support for arbitrary types (As long as the type has a AsString() function for it)
  • ReportGenerator bug correction: processeader() & processFooter() methods are now always called, even when there are no header nor footer.



I know the persons who have replied to this subject seem more interested about pure SQL reports but what if you are not doing SQL ??.

My solution can help them Wink


Re: Very Simple Report Generator (Use QTF format) [message #24384 is a reply to message #24351] Wed, 13 January 2010 12:22 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Didier wrote on Mon, 11 January 2010 23:53

Hi,

I've updated my ReportGenerator to add Image support.
While playing around with it for my own usage I noticed that Tables and bullets where already supported.
[...]

I know the persons who have replied to this subject seem more interested about pure SQL reports but what if you are not doing SQL ??.

My solution can help them Wink



Hello Didier,

I have downloaded your package to test it. It seems very promising. Then I discovered it requires boost. It's a pity to have used an external library for this potentially very useful program.
I tried to download boost (not less than 30 Mb Rolling Eyes ) but for some reason their server didn't permit me to download it. I will try later.
In the meanwhile let me ask you how big will be the final executable when the boost library will be statically linked.

Thank you,
Luigi
Re: Very Simple Report Generator (Use QTF format) [message #24394 is a reply to message #24384] Wed, 13 January 2010 22:37 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Luigi,

Well I used boost Spirit for sure but the good news is that it's only headers !)
Which means there is no library to link with. Compile the code that uses it and it's done.

In fact, in my project I added a UPP package named Boost_1.41.
It contains the boost zip unpacked and ... only an include path to it:
- no libs
- no source files.
==> It's almost an empty project Wink

I only used it as a facility to manage the include path to the boost files.

In practice:
Create the boost_1_41_0 package.
Open the package organiser
-> add an internal include containing "."
Unzip the boost zip in the package directory.

You're done !

I'm gonna try to make the boost package with only the necessary headers, no source files nor help or test code: just the minimum.
I hope it won't get to big Confused

Concerning the size, spirit is designed to build only the necessary code so it's not very big.
The application size is not a good indication so heres one:

* 454472 ReportGenerator.o
* 13692 StringReplacer.o

When you compare what's in StringReplacer.cpp (almost nothing) I think the size of ReportGenerator.o which contains everything else is quite small Smile

The only drawback to using boost::spririt is that you need a good C++ compiler. But that shouldn't be to hard to find Wink

Here a screenshot of the 3 example reports generated from 3 different templates but with the same user code.

index.php?t=getfile&id=2101&private=0

[Updated on: Wed, 13 January 2010 23:31]

Report message to a moderator

Re: Very Simple Report Generator (Use QTF format) [message #24402 is a reply to message #24394] Thu, 14 January 2010 14:09 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Didier wrote on Wed, 13 January 2010 22:37


I'm gonna try to make the boost package with only the necessary headers, no source files nor help or test code: just the minimum.
I hope it won't get to big Confused



Very good!
All my temptive to download the library are failed so far.

Luigi
Re: Very Simple Report Generator (Use QTF format) [message #24406 is a reply to message #24402] Thu, 14 January 2010 23:44 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Luigi,

Here is the Boost 1.41.0 package that is needed by the ReportGenerator.

NB: I changed the name of the package so you need to update the dependency in the ReportGenerator package

I managed to pack it just limit Shocked

EDIT: removed zipped file ==> see newer package

[Updated on: Sat, 16 January 2010 01:30]

Report message to a moderator

Re: Very Simple Report Generator (Use QTF format) [message #24415 is a reply to message #24406] Fri, 15 January 2010 22:37 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Didier wrote on Thu, 14 January 2010 23:44

Hi Luigi,

Here is the Boost 1.41.0 package that is needed by the ReportGenerator.

NB: I changed the name of the package so you need to update the dependency in the ReportGenerator package

I managed to pack it just limit Shocked




Hi Didier,

I managed to my best to correct the dependency but I continue to get complain from compiler.
Please let me ask you to post the entire stuff report+test+boost already tested and working Smile .

Thank you for your patience,
Luigi
Re: Very Simple Report Generator (Use QTF format) [message #24416 is a reply to message #24415] Sat, 16 January 2010 01:32 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Luigi,

Here is the complete package:

Unpack everything in Bazaar and it should compile.

If it doesn't work, what compiler are you using ?

I'm on linux with GCC 4.4.1

Didier

EDIT: removed zip file (cause incomplete)

[Updated on: Sat, 16 January 2010 10:35]

Report message to a moderator

Re: Very Simple Report Generator (Use QTF format) [message #24417 is a reply to message #24416] Sat, 16 January 2010 10:39 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Luigi,

I made another chack this morning and it seems there was a conflict with the version of boost that was installed on my linux and the one that I am using for the ReportGenerator.

After removing the default Boost from my linux, ReportGenerator doesn't compile any more ==> some files must be missing Sad .

I will correct this and deliver a valid package this time Very Happy

Sorry Embarassed
Re: Very Simple Report Generator (Use QTF format) [message #24418 is a reply to message #24417] Sat, 16 January 2010 11:25 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
OK this one is the good one Smile

Two files were missing in boost/function

I unpacked everything and recompiled it all with no problems.

EDIT: removed zip file ==> see updated version

[Updated on: Sun, 17 January 2010 20:33]

Report message to a moderator

Re: Very Simple Report Generator (Use QTF format) [message #24419 is a reply to message #24418] Sat, 16 January 2010 13:53 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Didier wrote on Sat, 16 January 2010 11:25

OK this one is the good one Smile

Two files were missing in boost/function

I unpacked everything and recompiled it all with no problems.




Hi Didier,

my MSC9 says:

----- ReportGenerator ( GUI MSC9 WIN32 MSC ) (2 / 13)
cl : Command line error D8003 : missing source filename
cl : Command line error D8003 : missing source filename

Do you know what it does mean?

Luigi
Re: Very Simple Report Generator (Use QTF format) [message #24420 is a reply to message #24419] Sat, 16 January 2010 19:20 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hummm Confused

I practically never compile under windows but after looking quickly on the net I found this:

http://msdn.microsoft.com/en-us/library/aa983368%28VS.80%29. aspx

It looks like MSC9 doesn't like my very simple boost project with no source files.
Maybe adding a dummy.cpp file that does nothing could solve this (just to make the compiler happy).

I'm gonna take a look at this windows problem.

Anybody else have ideas about this ?

Re: Very Simple Report Generator (Use QTF format) [message #24421 is a reply to message #24420] Sun, 17 January 2010 03:21 Go to previous messageGo to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Didier wrote on Sat, 16 January 2010 19:20


Anybody else have ideas about this ?


Hello, Didier.

Just download your reconfigured packages and see how it was done:
ReportGeneratorComplete.7z (1 Mb).
Previous Topic: BarCode128: string to image (Candidate for upload to Bazaar)
Next Topic: Simple INI parser (15 mb in 4 s, DualCore 2500 Mhz)
Goto Forum:
  


Current Time: Thu Mar 28 14:35:41 CET 2024

Total time taken to generate the page: 0.02126 seconds