Fully Dynamic Report and Data Generation - Help please

cbr00tcbr00t Izmir, Turkiye
edited June 2011 in FastReport .NET
First, sorry for my bad english.
Before FR.NET, I used FR COM version. I could able to generate data dynamicly with these events: 'IsEOF, OnFirst, OnNext...' etc.
On .NET version, can I do an enumeration as being in COM version.

I will use an dynamic object. There's no Properties for Columns, No Fixed Data...

Can I do something like this on .NET version of FastReports?
If you do some changes to support usage like this, I'll be happier.

My boss is very pleasure of this product. We want to buy license of FastReports.NET
and use this product on our commerical programs.
But, he want to see a FULLY DYNAMIC REPORT GENERATION DEMO before buy.
I searched other tools and there's no reporting tool effective like FastReport.


I want to build a report with a code like this:
public class CReportGenerator {
     public delegate void OnDataNeededProc( IntPtr szColumnName, out IntPtr pszCallbackData );


     protected FastReport.Report report;
     public OnDataNeedProc OnDataNeedBlock;
     protected int dataCount, enumIndex;

     public int DataCount {
          get { return dataCount; }
          set { dataCount = value; }
     }


     public void startReport() {
          report = new Report();
          

          // I can put All Column Names -used in report- with a property -if needed- like this:
          report.ColumnNames = "anagrup\ngrupkod\ngrupadi\nstokkod\nstokadi\nbarkod";


          // I only want to assign some events for building data.
          //      Report Definition will be generated directly by a XML (.frx file)
          // For every Nested Databands, I need an event that have a parameter: 'ColumnName'

          report.IsEOF += () => (enumIndex < dataCount);
          report.First += () => { enumIndex = 0; };
          report.Next += () => { enumIndex++; };

          /* I expect that if there are nested 'DataBand' objects
                 , Report will enumerate like this:
                           - Data1, Index: 0
                           -       Data2, Parent: 0, Index: 0
                           -       Data2, Parent: 0, Index: 1
                           -       Data2, Parent: 0, Index: 2
                           - Data1, Index: 1
                           -       Data2, Parent: 1, Index: 0
                           -       Data2, Parent: 1, Index: 1
                           - Data1, Index: 2
                           -       Data2, Parent: 2, Index: 0
                           -       Data2, Parent: 2, Index: 1
                           -       Data2, Parent: 2, Index: 2
                     ... etc
          */
         

          report.DataNeeded +=__report_event__onDataNeeded;
     }

     void __report_event__onDataNeeded( string columnName, out object callbackValue) {
            IntPtr szColumnName;
            IntPtr pszCallbackValue;
            string __callbackValue;


            if (OnDataNeededBlock == null)
                  return;


            szColumnName = Marshal.StringToHGlobalAnsi( s: columnName );
            pszCallbackValue = Marshal.AllocHGlobal( cb: IntPtr.Size );


            OnDataNeededBlock( szColumnName, out pszCallbackValue );

            callbackValue = Marshal.PtrToStringAnsi( ptr: pszCallbackBuffer );
     }
}

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.