This problem relates to report design in BIRT.
Due to limitations in the data source, I have a data set with the following rows:
Id Name Class
---------------
1 Name1 Foo
2 Name1 Bar
3 Name2 Fizz
4 Name2 Buzz
5 Name3 Baz
Duplicates of the name column should be suppressed, and only the last result should be displayed:
Id Name Class
---------------
2 Name1 Bar
4 Name2 Buzz
5 Name3 Baz
How can I do that?
(Assuming your data is in ID order)
Insert a Group in your BIRT report, on name.
Copy the detail row items into the new group footer.
Delete the detail row and new group header row.
The output from the report should match your requirements.
Related
I have table data as mentioned below.
Id Name Type
1 ABC SCAN
2 BDC SCAN
3 ABC MANUAL
4 BDC EXTDEV
5 ABC EXTDEV
As per the above Tbl data want ABC data including all 3 types.
I have tried below function
export const getInventoryScanProductByAccNameAndType = async (
accName
) => await db.InventoryScans
.where(['AccountName', 'ProductEnterType']).anyOf(accName, ['SCAN', 'MANUAL', 'EXTDEVICE']).toArray();
Can anyone help me to get the data below?
Id Name Type
1 ABC SCAN
2 ABC MANUAL
3 ABC EXTDEV
I am trying to export data from excel into a hive table, while doing so, i have a column 'ABC' which has values like '1,2,3'.
I used the lateral view explode function but it does not does anything to my data.
Following is my code snippet :
CREATE TABLE table_name
(
id string,
brand string,
data_name string,
name string,
address string,
country string,
flag string,
sample_list array )
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE
;
LOAD DATA LOCAL INPATH 'location' INTO TABLE
table_name ;
output sample:
id brand data_name name address country flag sample_list
19 1 ABC SQL ABC Cornstarch IN 1 ["[1,2,3]"]
then i do:
select * from franchise_unsupress LATERAL VIEW explode(SEslist) SEslist as final_SE;
output sample:
id brand data_name name address country flag sample_list
19 1 ABC SQL ABC Cornstarch IN 1 [1,2,3]
I also tried:
select * from franchise_unsupress lateral view explode(split(SEslist,',')) SEslist AS final_SE ;
but got an error:
FAILED: ClassCastException org.apache.hadoop.hive.serde2.objectinspector.StandardListObjectInspector cannot be cast to org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector
whereas, what i need is:
id brand data_name name address country flag sample_list
19 1 ABC SQL ABC Cornstarch IN 1 1
19 1 ABC SQL ABC Cornstarch IN 1 2
19 1 ABC SQL ABC Cornstarch IN 1 3
Any help will be greatly appreciated! thank you
The problem is that array is recognized in a wrong way and loaded as a single element array ["[1,2,3]"]. It should be [1,2,3] or ["1","2","3"] (if it is array<string>)
When creating table, specify delimiter for collections:
FIELDS TERMINATED BY '\t'
COLLECTION ITEMS TERMINATED BY ','
I wanted to provide my answer.
The issue was with the input that was being provided. My input txt file had [] around the input value. They had to be removed and it worked.
Laravel Eloquent condition to fetch hierarchy level.
I have a table named routes and it is self-referencing
Sample data:
(PK)
Id title route_id
1 users null
2 home null
3 foo 1
4 bar 3
5 hoge 3
I would want to have a function to get routes according to its hierarchy
$this->routes->getByHierarchyLevel(1);
// results
Id title route_id
1 users null
2 home null
$this->routes->getByHierarchyLevel(2);
// results
Id title route_id
3 foo 1
$this->routes->getByHierarchyLevel(3);
// results
Id title route_id
4 bar 3
5 hoge 3
Is there a single chained query builder/eloquent builder possible for this one?
I already made a custom function of this one but it is a looped query or the other solution is fetch all and filter.
I would suggest to introduce a new column level in your routes table and at the time of insertion detect their nested level and save it in your table, this way you can perform your filters easily without any extra overhead , otherwise you would need complex/expensive queries to be able to detect their level and apply filter
id
title
route_id
level
1
users
null
1
2
home
null
1
3
foo
1
2
4
bar
3
3
5
hoge
3
3
In my report, there is a table which shows Item number, Employee name, and Hours.
Item Number Employee Hrs
1 ABC 2
1 DEF 1
2 ABC 3
2 XYZ 4
I want to show one empty row below as a separator when Item number get change. In that row want to show the total number of hours. Like below.
Item Number Employee Hrs
1 ABC 2
1 DEF 1
Total 3
2 ABC 3
2 XYZ 4
Total 7
Thanks, Bhushan the link was helpful. Link: https://learn.microsoft.com/en-us/sql/reporting-services/lesson-6-adding-grouping-and-totals-reporting-services?view=sql-server-2017.
I changed the report design by adding grouping. Also showing sum after each group.
I have a table Orders like this:
ID
CustomerID
name
ID CustomerID name
1 4 aa
5 6 bbb
4 9 ccc
8 10 ddd
first ordering the table,then get the next row..... How to do?
if current row id is 4 ,i want to get the row where id==5
I think you want this:
Orders.OrderBy(x=>x.ID).Skip(1).Take(1)
Edit: If I understand your question now:
Orders.OrderBy(x=>x.ID).Where(x=>x.ID>4).FirstOrDefault();