To show blank in the 1st row (if it is NULL value) in BIRT Reports - eclipse

I created a Report using BIRT Report Design in Eclipse Java EE IDE(Juno Release). In that Report, For the single row it have multiple values for the corresponding one column(I used LISTAGG() oracle function to map that).
(i.e.) Result column have multiple values in the below database table output :
No Name Result Mark
1 John X 32
XX
XXX
2 Joe X 56
XX
XX
XXX
3 Andrew 34
XXX
XX
XXXX
… It have both NULL and NOT NULL values in it.
"If the NULL values are in the middle means its showing the results properly in the Report"
Sample Result am getting in Report output for Joe (.pdf form)
No Name Result Mark
2 Joe X 56
XX
XX
XXX
Here the problem is, “If First record has a NULL means it is not showing properly in the Report, instead of that NOT NULL value will print in the front and so on…”
Sample Result am getting in Report output for Andrew (.pdf form)
No Name Result Mark
3 Andrew XXX 34
XX
XXXX
But we have TWO NULL values present in the Front of Result column for Andrew (As you see sample database table output above)…
Is there any option to show blank in the first row(if it is a null column) for the particular row in the Birt report tool ?
Kindly Help me to Solve this issue… Thank you!

Related

Crystal Reports SUM formula help. Don't SUM values with specific IDs

I have a table with rows of Invoice data and I want to SUM the values of all line items where the Item ID is not equal to 0000 or 9999.
The Item IDs I want to exlcude 0000 and 9999 never change.
ITEM ID
NAME
WORK VALUE
TOTAL COMPLETED
0000
HOLD 1
0.00
1,234
1234
MATERIAL A
333.00
76.00
1235
MATERIAL B
567.00
7043.00
1236
MATERIAL C
981.00
321.00
1237
MATERIAL 4
430.00
5445.00
1238
MATERIAL 5
10.00
897.00
1239
MATERIAL 6
18.00
654.00
1240
MATERIAL 7
882.00
3.00
1241
MATERIAL 8
777.00
65.00
9999
ZY HOLD
0.00
111.00
So the value returned in the report from the example above should = 18,502.00 not 20,847.00
I have tried:
IF NOT((TONUMBER({Invoices.InvoiceItems~ItemNumber}) = 9999))
THEN
(SUM({Invoices.InvoiceItems~InvoiceValue})+SUM({Invoices.InvoiceItems~TotalCompleted}
but this doesn't work, it still sums the value from the 9999 line item
I would create a Running Total Field to accomplish this.
A Running Total Field works very similar to the Summary Field, but allows a lot more control over which records are evaluated when summarizing the data. To setup a Running Total Field for your needs try the following steps.
Create a new Running Total Field.
Set the "Field to summarize" to use the Total Completed column from your database. Set the "Type of summary" to SUM.
Set the radio button in the "Evaluate" section to "Use a formula", then click the X-2 button to create the formula that will determine if a row of data should be included in the sum or not. Whatever formula you enter here will need to return a boolean value. When this value is TRUE, the row's data is included, and when it's FALSE the row's data will be excluded. I would use the following formula here: TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 9999 AND TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 0000
The last thing to do is the setup the Reset conditions for the Running Total Field. This would be used if you were grouping data in some fashion such as by Customer and would allow you to sum the data for a single customer, then reset to zero for the next customer. If you are not using any grouping you can probably just leave this set to "Never".
Click OK to finish. :)
At this point all you need to do is drop the Running Total Field you just created into your report. Be mindful about which sections you place this field within though. If you place it in a header section, you will likely find it doesn't add in the last record in your dataset because the report hasn't printed it to the details section yet. I recommend placing Running Total Fields in Footer sections to avoid this nuance.
I hope this helps! And if you do have some grouping levels that you need help with setting the reset conditions just let me know what the grouping levels are for your report and I can update this answer for you.
You can create a new formula similar to yours:
IF TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 9999
AND TONUMBER({Invoices.InvoiceItems~ItemNumber}) <> 0
THEN {Invoices.InvoiceItems~TOTALCOMPLETED}
ELSE 0
and then just sum this formula field up.

Pentaho spoon transformation from excel file

I have yearly data in my excel file in such format:
Country \ Years 1980 1981 ... 2010
Abkhazia 234 334 ... 456
Afghanistan 466 789 ... 732
...
Here is picture
And I want my data transform to 3 different tables and load it to postgres database.
Tables should look something like that
First table - country:
id | name
1 | Abkhazia
2 | Afghanistan
Second table dates:
id | date
1 | 1980
2 | 1981
And third is a table where all data is stored depending on country and date:
country_id date_id data
1 1 234
1 2 334
2 1 466
2 2 789
... ... ...
Any ideas how I could achieve my goal?
Assuming the source excel structure is as below (i have custom built this):
There are basically 3 parts to your question. I break down the transformation into part for better understanding:
1. Loading Table - Country
This is pretty straight forward based on the data given in the excel. Simply take an
Excel Input >> Add a sequence step. Give the Sequence name as Country ID >> Select only the Country Name and Country ID >> Load into the Country Table using Table Output.
2. Loading Table - Year:
The idea here is to display the Year ID in Row wise format instead of the columns given the excel source data. PDI version 5 and above provides you with a very useful step called Metadata Structure. This step allows you to get the structure of your table. In this case, we need to have the year columns pulled, ignoring the country column.
Follow the steps as below:
Read the Excel Data >> Get the Metadata structure of your source >> Filter Out the Country Column (which is available in row at position=1) >> Add a Sequence Number. Name it YearID >> Finally Load the Year Table.
3. Loading the Final Table - Country and Year along with Data:
The way to display all the column data values to a row level in PDI is using Row Normalizer step. Use this step to display a normalized output. Now follow the below steps:
Read the Excel source data >> use Row Normalizer Step to normalize the rows based on the Years >> Do a Stream Lookup with the Above Country and Year tables to fetch the CountryID and YearID respectively >> Finally Load the necessary column data into Table Output
Hope it helps :)
I have placed the codes in github repo along with the data file which i have used. Its here.
Also, just realized that i have given the wrong naming conventions as per your question. Consider date_id as YearID and instead of id's i have given countryid and yearid.

Sub report links in crystal reports

I have a report having a command object where I have empno and some columns. And I have another command object which also having empno.
For 1st command the parameter is division and based on division I will get some empnos in 1st commnd object and I need to pass this empnos from 1st command object to 2nd command object.
So that the 2nd command object should get some empnos from 1st command object and should display countries based on the matched empnos .
So I linked both command objects empnos in links tab.
Due to some performance issue I am doing like this
Created a sub report with 2nd command object and created empno parameter. Now in sub reports links tab I am passing main reports empno to sub reports empno parameter.
But I am getting non matching empnos data.
Please suggest
Here what I observed in my 1st table have data like this.
eno name division
1 aaa 2
2 bbb 2
3 ccc 2
In my 2nd table I have data like this
eno country division
1 India 2
2 Aus 2
By using 1st method(linking command objects in links tab).
I am getting result like this.
eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
By using 1st method(Sub report approach).
I am getting result like this.
eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
3 ccc 2
I need to get only employees present in both tables using sub report approach.
Please suggest
Hi Siva i am unable to post the image I am getting data like this.In my 2nd table I have onlt enos 1 and 2 .But I am getting all the emps even I used record selection formula also
**eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
3 ccc 2**
when you use sub report for this purpose then you should not link parameters of main report to sub report instead you should use the linked parameter in Record Selection Formula of sub report then your filtering applies to sub report.
for e.g:
pass the parameter to sub report through links (Take care dont link the parameters) then you will get siomething like this {pm-parameter1}.
then go to record selectoin formula and write as
database field = {pm-parameter1}

Dynamic vertical lines in Crystal Reports 10.5

Crystal Reports Ver 10.5
I have a crystal report which shows up to 9 fields, but user can choose between 1 to 9 fields. I have implemented this using check boxes on a form and user can select any box from 1 to 9 and generate a report. So the report can show from 1 field to 9, and any columns can be any field at a given time. (for eg. the user might select ID, Name, Phone from the form and view report. So the first column in the report becomes ID and so on. If he selected Name and Phone, the first column becomes Name and so on. I have done this using Parameter fields.
Now I would like to bring a vertical separation between columns and Only if the columns has data (Remember there can be 1 to 9 columns having data). I can't put the lines beforehand because they will be shown regardless of the number of fields shown.
Anybody has an idea of how to bring this vertical line between ?
Thanks in advance.

Crystal reports - how to handle null while using group

I would like to know which is the best way to include null values in the report while using the below groups. My below report uses two groups one below other, Month group is under the field group. I have given the formula for the Field Group A; and for for the month I have used options to fetch the months from the specific date field [source is excel file] in ascending order. Since there are no data for group A - 1 records for October month I don't see any data whereas I would want to show the month with NA as result.
Report looks like below currently
Field GROUP -A - 1
Month Result
11-2012 xxx
12-2012 xxx
Field Group A- 0
Month Result
10-2012 xxx
11-2012 XXX
12-2012 xxx
But I would like the report to be as below:
Field GROUP -A - 1
Month Result
10-2012 NA
11-2012 xxx
12-2012 xxx
Field Group A- 0
Month Result
10-2012 xxx
11-2012 XXX
12-2012 xxx
Any suggestions will be helpful
Crystal Reports can't show the data, because there isn't any data to show.
There's only one instance I'm aware of where Crystal Reports will auto-fill NULL data, and that's when using a crosstab, which really doesn't appear to fit your needs or desired output.
You'll have to supply the "N/A" value for 10-2012, Group 1 in your query, possibly by using some table of dates to outer join against.