Cross tab for Accummulated Aggreggate function

Stimulsoft Reports.WEB discussion
victorinable
Posts: 152
Joined: Mon Aug 03, 2015 9:28 am

Cross tab for Accummulated Aggreggate function

Post by victorinable »

Hi,

Good morning. I'm wondering how to succeed on creating a cross tab in the following scenario:

I have a 2 DataSets, one with facts and a Date dimension. Facts is Raw data, and the registers have an startDate and endDate, so I know on wich days/months/year this register is active. What I would like to do Is to count per month which is the total number of active registers. I would like to have it in a Table, so I would like to use Cross-Table, is this possible? How is the best way to do this?

I succeed on having the number of registers that have been activated per period, but not the total.

Thanks in advance.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Cross tab for Accummulated Aggreggate function

Post by HighAley »

Hello.

It's not clear what data do you have and how this should be presented.
Could you send us a little sample that will send us to see your issue in details?

Thank you.
victorinable
Posts: 152
Joined: Mon Aug 03, 2015 9:28 am

Re: Cross tab for Accummulated Aggreggate function

Post by victorinable »

Hi,

Here I attach you a brief (Only needed columns) involved on the report I want to create.

"Libro3" is a subset of dates (Initial dates of every month for a year) and "Libro2" is, imagine, active customers (With start and end date).

What I want to see, is for every month, how many users are active (One user can be active for more than 1 month, or for the whole year, for a simple month...) in a tabular way. And, of course, the number of rows will depend on the number of rows included on "Libro3".

Is this possible? Can I use something similar to a cross tab to have it the same way (Or similar) is presented? Should I create a relation between both datasets somehow?

Thanks in advance.

PS: In "Example" file you can see the main idea. You can ifnore the column as Is don't really needed, it can be a Cross-tab with no cols.
Attachments
Example
Example
Example.PNG (6.05 KiB) Viewed 3666 times
Libro3.csv
Dimension (TableB)
(129 Bytes) Downloaded 305 times
Libro2.csv
Facts (TableA)
(9.1 KiB) Downloaded 290 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Cross tab for Accummulated Aggreggate function

Post by HighAley »

Hello.

You don't need to use cross-tab.
This report could be create in master-detail scenario.
The Master Component and Filter should be set for second band.
Also you should use next code in after Print event of Master Band.

Code: Select all

StiDataHelper.SetData(DataLibro2, true);
Furthermore, if you need to get sum for each month of the year it's possible to set the report more simple.

P.S. The data in csv file was wrong, we have made some changes.

Thank you.
Attachments
Libro2.csv
(9.1 KiB) Downloaded 368 times
Libro3.csv
(129 Bytes) Downloaded 331 times
Report.mrt
(6.56 KiB) Downloaded 412 times
victorinable
Posts: 152
Joined: Mon Aug 03, 2015 9:28 am

Re: Cross tab for Accummulated Aggreggate function

Post by victorinable »

Hi Aleksey,

Thanks for the great response. Just a question, It's possible to do it in a Table? I mean... I would like to present it as a table, if possible. Otherwise I'll do it that way, but my customers are used to have it as a table.

As far as I know, I haven't seen the possibility to use 2 DataSets ina cross-tab, but i wonder if there is any walkaround.

Thanks in advance!
victorinable
Posts: 152
Joined: Mon Aug 03, 2015 9:28 am

Re: Cross tab for Accummulated Aggreggate function

Post by victorinable »

Just a question... Where do I can find the event you mentioned? I go to code but I really don't know how to locate it. Maybe should I create it? Or how is its name?

Thanks.
victorinable
Posts: 152
Joined: Mon Aug 03, 2015 9:28 am

Re: Cross tab for Accummulated Aggreggate function

Post by victorinable »

Hi again,

I created the report the same way you told, and also added the event you suggested and added the line of code you told me.

I can't see anything when I preview it. Can you please check if I'm missing something?

Thanks in advance
Attachments
Conexión_Oracle.mrt
Report with Real Data
(14.53 KiB) Downloaded 343 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Cross tab for Accummulated Aggreggate function

Post by HighAley »

Hello.
victorinable wrote:Thanks for the great response. Just a question, It's possible to do it in a Table? I mean... I would like to present it as a table, if possible. Otherwise I'll do it that way, but my customers are used to have it as a table.
Could you specify what do you mean under Table? If it is a Table component then it's possible to use them instead of the Data Bands. But you will not get such flexibility as you get with Data bands.
victorinable wrote:As far as I know, I haven't seen the possibility to use 2 DataSets ina cross-tab, but i wonder if there is any walkaround.
You could use data from different data sources if there is a relation between them.
victorinable wrote:I can't see anything when I preview it. Can you please check if I'm missing something?
It hard to say what is wrong without any data. As we see you set filter of DataBand1 wrong. The type of the AÑO column is Decimal and you set that it is string.

Thank you.
victorinable
Posts: 152
Joined: Mon Aug 03, 2015 9:28 am

Re: Cross tab for Accummulated Aggreggate function

Post by victorinable »

Hi Aleksey,

Yes, I meant to have a table element, but as you said, I'll lose the flexibility of DataBands, I'll do it as you suggested, using Master Detail.

I knew I could use multiple Datasets if there is a relation, but If I need dimension DATE (To get periods) there is no "Match case" relation, on the whole date, so no relation is possible.

I changed what was wrong in the filter but still nothing's rendered. What I'm doing is exactly the same as you suggested but instead of using the CSV's I provided, I'm using an Oracle connection to get both tables (Dim + Facts), then using Dim as master and facts as detail. If i send you the report + the exportation of Data, it will help you to help me ( :idea: )? Just ask me what you need.

I'm trying different possibilities and different conditions for filtering, as I guess there is something not working fine.

Thanks for the responses.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Cross tab for Accummulated Aggreggate function

Post by HighAley »

Hello.

1. At first we should be sure that you have access to data. Choose View Data in the context menu of Data Source. If you see any data then go on.

2. To send us necessary data you could use next code in the BeforePrint event of a page:

Code: Select all

H991162_DIM_TIEMPO.DataTable.DataSet.WriteXml("e:\\data.xml");
H991162_DIM_TIEMPO.DataTable.DataSet.WriteXmlSchema("e:\\data.xsd");
3. Send this data with your current report template to support@stimulsoft.com.

Thank you.
Post Reply