Flex Array as datasource

Stimulsoft Reports.Flex discussion
Frotsen
Posts: 15
Joined: Mon Apr 19, 2010 8:02 am
Location: Norway

Flex Array as datasource

Post by Frotsen »

Is it possible to use an Array or ArrayList as datosource. If so you can you please provide an example code on how to do so?

Regards
Frotsen
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Flex Array as datasource

Post by Andrew »

Dear Frotsen,

Unfortunately, on the current moment, it is not possible. On the current moment we support only XML and MySQL datasources.

Thank you.
Frotsen
Posts: 15
Joined: Mon Apr 19, 2010 8:02 am
Location: Norway

Flex Array as datasource

Post by Frotsen »

Well thats very disappointing, hopefully it will come in a future version. What about and xmlDocument object? Atm i can only see xml loaded from file as a datasource stixmlDatbase(name as string,xsdpath as string, xmlPath as string) , witch againg it not very usefull. Do you have any example where you use and Xmldocument object as datasource?

Regards
Frotsen
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Flex Array as datasource

Post by Vladimir »

Hello, Frotsen

Unfortunately, Stimulsoft Reports.Fx for Flex supports only XML files as a data source. At this moment we are working on major export formats, then we will expand the supported data sources. Data sources you specified will be realized first.

Thank you.
Marek
Posts: 1
Joined: Wed Aug 25, 2010 7:02 am

Flex Array as datasource

Post by Marek »

Has anything changed on this? Can I use the Array or ArrayCollection as a dataSource to the designer
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Flex Array as datasource

Post by Vladimir »

Hello,

On the current moment we are working to extend the functionality of databases and data sources supported. We plan to complete it by mid-September.

Thank you.
jorool
Posts: 44
Joined: Wed Dec 08, 2010 1:39 pm
Location: Brazil

Flex Array as datasource

Post by jorool »

Hello, Vladimir!

News about databases connections and/or arrayCollection as dataSource?

Thank you.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Flex Array as datasource

Post by Vladimir »

Hello,

For connecting data to a report, you must convert data to the XML format or to DataTable and DataSet structures, and then register data in the report.

Example 1:

Code: Select all

var xml: XML =

   
      1
      John Smith
   
   
      2
      Antonio Moreno
   
   
      3
      Elizabeth Brown
   
;

var report: StiReport = new StiReport();
report.regData("Demo", "Demo", data);
report.dictionary.synchronize();
report.design();

Example 2:

Code: Select all

var table: DataTable = new DataTable("Customers");
var column: DataColumn = new DataColumn("CustomerName", StorageType.StringType);
table.columns.add(column);

table.addNewRow().sett("CustomerName", "John Smith");
table.addNewRow().sett("CustomerName", "Antonio Moreno");
table.addNewRow().sett("CustomerName", "Elizabeth Brown");

var dataSet: DataSet = new DataSet("DataSetName");
dataSet.tables.add(table);

var report: StiReport = new StiReport();
report.regData("DataSetName", "DataSetName", dataSet);
report.dictionary.synchronize();
report.design();

Also you can use the following functions:

Code: Select all

report.regData(name, alias, data);  // Universal function, which itself determines the type of data
report.regDataSet(name, alias, dataSet);
report.regDataTable(name, alias, dataTable);
report.regDataXML(name, alias, data);
report.regDataXMLDocument(name, alias, data);
report.regDataXMLNode(name, alias, dataNode, schemaNode);

Thank you.
trademark16
Posts: 20
Joined: Sun Aug 29, 2010 2:56 am
Location: Buffalo, NY

Flex Array as datasource

Post by trademark16 »

When using the regDataXML method it appears to work, almost. I can see my data on the report however, in front the loading window get stuck on Loading Images ( i currently have no images on report) and the progress bar continues to run. I can never access my report. Any Ideas? Below is my code.

var loader: URLLoader = event.target as URLLoader;
var documentString: String = loader.data as String;

report.loadReportFromString(documentString);
report.regDataXML("SalesPerson", "SalesPerson", xmlSp);
report.dictionary.synchronize();
viewer.report = report;

xmlSp is an XML object with my data.

Also, if i want to load data for more than one report Data Source can that be done in one statement or would it need to be done like this:

var loader: URLLoader = event.target as URLLoader;
var documentString: String = loader.data as String;

report.loadReportFromString(documentString);
report.regDataXML("SalesPerson", "SalesPerson", xmlSp);
report.regDataXML("Bookings", "Bookings", xmlBook);
report.dictionary.synchronize();
viewer.report = report;

Thanks
trademark16
Posts: 20
Joined: Sun Aug 29, 2010 2:56 am
Location: Buffalo, NY

Flex Array as datasource

Post by trademark16 »

How would I connect data to a report where I have multiple Data Sources? I tried this with no luck:

report.loadReportFromString(documentString);
report.dictionary.databases.clear();
report.regDataXML("SalesPerson", "SalesPerson", xmlSp);
report.regDataXML("Bookings", "Bookings", xmlBook);
report.dictionary.synchronize();
viewer.report = report;

And this with no luck:

report.loadReportFromString(documentString);
report.dictionary.databases.clear();
report.regDataXML("SalesPerson", "SalesPerson", xmlSp);
report.dictionary.synchronize();
report.regDataXML("Bookings", "Bookings", xmlBook);
report.dictionary.synchronize();
viewer.report = report;
Locked