Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends ,
need small help on format change give examples on file please check attached can we do in script
Hi
Try like this
Table1:
LOAD * INLINE [
Head, Data
A, 12
B, 15
C, 16
D, 54
E, 40
F, 12
];
Load 'Total' AS Head, Sum(Data) AS Data, 1 AS SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D') ;
Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D');
Load 'Total1' AS Head, Sum(Data) AS Data, 6 AS SortOrder Resident Table1 Where Match(Head, 'E', 'F');
Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'E', 'F');
DROP Table Table1;
Head | Data | SortOrder |
---|---|---|
Total | 97 | 1 |
A | 12 | 2 |
B | 15 | 3 |
C | 16 | 4 |
D | 54 | 5 |
Total1 | 52 | 6 |
E | 40 | 7 |
F | 12 | 8 |
Hope this helps
The information you are missing is how the Heads are grouped. Like:
Head Group
A Group1
B Group1
C Group1
D Group1
E Group2
F Group2
If you can add that, you can load grouped on Group and get sub-totals
Hi Ralf ,
we need it in same like attached output
outcome should same as output table can we do that in script
Hi
Try like this
Table1:
LOAD * INLINE [
Head, Data
A, 12
B, 15
C, 16
D, 54
E, 40
F, 12
];
Load 'Total' AS Head, Sum(Data) AS Data, 1 AS SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D') ;
Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D');
Load 'Total1' AS Head, Sum(Data) AS Data, 6 AS SortOrder Resident Table1 Where Match(Head, 'E', 'F');
Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'E', 'F');
DROP Table Table1;
Head | Data | SortOrder |
---|---|---|
Total | 97 | 1 |
A | 12 | 2 |
B | 15 | 3 |
C | 16 | 4 |
D | 54 | 5 |
Total1 | 52 | 6 |
E | 40 | 7 |
F | 12 | 8 |
Hope this helps
Hi Mayil
Inline table if i bring other fields output table going for task