Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Data Set Computed columns: Percentage(Problems getting the percentage (Computed columns).)
Data Set Computed columns: Percentage [message #659354] Sat, 12 March 2011 17:53 Go to next message
Gin is currently offline GinFriend
Messages: 13
Registered: March 2011
Location: Madrid
Junior Member
Problems getting the percentage (Computed columns).

I'm having problems when preparing the following report:

1 - I create a "data set" (Data set1) that returns the result of a select (count): 5
2 - I create a "data set"(Data set2) that returns the result of another count: 7
3 - I create a "Data set join" (Data set3) type "Ful Outer join" to unify both tables and working with them later.
4 - From the Dataset3 created earlier, try to add a column "Computed columns" to add the percentage. For this example, i created the following expression without any aggregation and citing the "Data type" float: (5 / 7) * 100

At the preview ("Preview results") profit Dataset3 shows the following information:
http://www.imagengratis.org/images/dataset.jpg

http://www.imagengratis.org/thumbs/dataset.jpg


Can you comment on why the information does not appear aligned dataset3 and why not calculate correctly the percentage? Is there any other optimal way to plan and build this report with BIRT?

Thanks in advance.
Regards,
Re: Data Set Computed columns: Percentage [message #659364 is a reply to message #659354] Sat, 12 March 2011 22:07 Go to previous messageGo to next message
Richard A. Polunsky is currently offline Richard A. PolunskyFriend
Messages: 212
Registered: July 2009
Location: Houston TX
Senior Member

You don't say what other columns are in your datasets. Based on your capture, the join is not putting your desired numbers on the same row - hence the division by zero error.

Can you list the columns in each of your datasets? Also, full outer join may not be the correct approach - usually if you are going to do something like this you assume both datasets have values so an inner join would work.
Re: Data Set Computed columns: Percentage [message #659427 is a reply to message #659364] Sun, 13 March 2011 19:24 Go to previous messageGo to next message
Gin is currently offline GinFriend
Messages: 13
Registered: March 2011
Location: Madrid
Junior Member
The problem, i think, is how to make the join between the two "dataset" so that the resulting table ("dataset3") returns the two "aligned" columns to calculate the percentage between the two.

The result of "dataset1" is one column with the value 5, and the result of "dataset2"is one column with a single value: 7. If I do some "inner join " (or "cross join ") of both dataset, the result returned two columns are aligned but with value 35 each. It is clear that the problem is how to relate the two columns (which have no common field) to calculate the percentage then: (5 / 7) * 100. Can you help me build this select?

For any clarification or further information do not hesitate to contact me.
Thank you very much!
Re: Data Set Computed columns: Percentage [message #659489 is a reply to message #659427] Mon, 14 March 2011 09:24 Go to previous message
Gin is currently offline GinFriend
Messages: 13
Registered: March 2011
Location: Madrid
Junior Member
Ok, I confirm that already works. The problem was a syntax error in the use of "distinct" in mysql. Already been solved and it works the percentage. Thanks.
Previous Topic:Adding fields to database table causes error What is best practice?
Next Topic:Load Report Libraries Dinamically
Goto Forum:
  


Current Time: Fri Apr 19 16:03:27 GMT 2024

Powered by FUDForum. Page generated in 0.03096 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top