im trying to create table with multiple sum using cross-tab in ireport, but i think cross-tab don't support multiple sum. my query is look like
|no|info |city |M |F |Total |
|1 |info1 |bandung |10 |5 |15 |
|2 |info1 |jakarta |13 |7 |20 |
and im looking for something like
|no|info |bandung |jakarta |total |
|__|_________|M |F |T |M |F |T |M |F |T |
|1 |info1 |10|5 |15|13|7 |20|23|12|35|
thanks before, sorry for my poor english.
i have resolved my problem, just drag item from pallet panel to add another variable.
Related
I have a grid table in restructuredText. Is there a way to add a caption to it?
+----------+---------+
|Name |Age |
+==========+=========+
|Bill |39 |
+----------+---------+
|Jane |38 |
+----------+---------+
There's no directive, so it's not like the figures:
.. figure:: strawberryicecream.png
Strawberry Ice Cream
Oh, never mind, the table directive works. I tried it earlier but didn't indent the table definition properly.
.. table:: Personnel
+----------+---------+
|Name |Age |
+==========+=========+
|Bill |39 |
+----------+---------+
|Jane |38 |
+----------+---------+
Here is my code:
!***< Hidden
!define TEST_SYSTEM {fit}
!path C:\Users\c008854\workspace\MQValidator\build\libs\*.jar
!path C:\Progra~1\dbfit-complete-3.2.0\lib\*
|import |
|com.connect|
*!
|Divisionp |
|numerator|denominator|quotient?|
|10 |2 |6.0 |
|12.6 |3 |4.2 |
|22 |7 |~=3.14 |
|9 |3 |<5 |
|11 |2 |4<_<6 |
|100 |4 |33 |
!|dbfit.OracleTest|
!|Connect|xxx.xxx.xxx.xxx.com:1522|xxxuser|xxxpass|xxxname|
However I get the following error
Connect Could not invoke constructor for Connect[4]
I looked at the following, but it didn't solve my problem.
DBFit - Could not invoke constructor for Connect[4]
Instead I got another error saying:
Connect Could not invoke constructor for DatabaseEnvironment
What is the reason for the error that is in the title?
It means the Connect initialisation (constructor) failed, either due to invalid credentials or other problems.
You should look at the Java logs to see what was the exact reason.
Put the line !|dbfit.OracleTest| as the first line on the page. This lets the DB Fit fixture control the entire page, and recognize commands like !|Connect|...
I have a database table with employees in it that can be grouped by department in the form of:
employees
department_id|employee_id| employee_firstname|employee_lastname
1 |1 | john | d
1 |2 | mary | s
2 |3 | ray | b
3 |4 | joe | d
I would like to group it by department and process it into separate output files (ideally excel but for simplicity it can be csv). Each department output file will contain its employees so department1.csv will have first 2 records, department2.csv will have third record and department3.csv will have forth record.
Do you know how to achieve it with spring batch?
Thanks in advance,
Grama
I am working in SAS/STAT 12.1 and I have only one issue with my code below, I need to show "Total" for the bottom row (displaying columns sums and percentages), instead of "Both Genders." And yes, the top right-hand column header (displaying row totals and percentages) still needs to be "Both Genders."
I hope there is a simple way to do this using keylabel, but haven't figured it out so far.
proc tabulate data=dmhrind format=8.1;
format gender $gendfmt. ethnic $ethnic.;
class ethnic gender;
table (ethnic all)*f=4. , (gender all)*(n*f=4. colpctn*f=5.1 rowpctn*f=5.1) ;
title 'Ethnic Distribution by Gender';
label ethnic='Race/Ethnicity';
keylabel N='N' colpctn='%' all='Both Genders' reppctn='%' rowpctn = 'Total';
run;
Thanks in advance for any assistance provided.
The only way to do this that I can see is to make a dummy column that simulates All. Using sashelp.class:
data class;
set sashelp.class;
allage = 'All Ages';
run;
proc tabulate data=class format=8.1;
class sex age allage;
table (age allage=' ')*f=4. , (sex all)*(n*f=4. colpctn*f=5.1 rowpctn*f=5.1) ;
title 'age Distribution by sex';
label age='Age';
label allage='All Ages';
keylabel N='N' colpctn='%' all='Both Sexes' reppctn='%' rowpctn = 'Total';
run;
It needs to have the text you want as the label as its actual value, and you need to replace all in the tabulate with that variable (and add it to the class statement), and add =' ' to override the extra label subrow.
For this, you need to do the titling within the table statement. The following example is similar to yours, using sashelp.class (as in #Joe's example) where age is used as your ethnicity variable:-
** This option helps improve proc tabulate output on some systems;
options formchar="|----||---|-/\<>*";
** The key is adding the column titles directly in the table stmt;
proc tabulate data=sashelp.class format=8.1;
class sex age;
table (age all='Total')*f=4. , (sex='' all='Both Sexes')*(n='N'*f=4. colpctn='Col %'*f=5.1 rowpctn='Row %'*f=5.1) ;
run;
The output should look like this:-
---------------------------------------------------------------------------
| | F | M | Both Sexes |
| |----------------|----------------|-----------------
| | N |Col %|Row %| N |Col %|Row %| N |Col %|Row %|
|----------------------|----|-----|-----|----|-----|-----|----|-----|------
|Age | | | | | | | | | |
|----------------------- | | | | | | | | |
|11 | 1| 11.1| 50.0| 1| 10.0| 50.0| 2| 10.5|100.0|
|----------------------|----|-----|-----|----|-----|-----|----|-----|------
|12 | 2| 22.2| 40.0| 3| 30.0| 60.0| 5| 26.3|100.0|
|----------------------|----|-----|-----|----|-----|-----|----|-----|------
|13 | 2| 22.2| 66.7| 1| 10.0| 33.3| 3| 15.8|100.0|
|----------------------|----|-----|-----|----|-----|-----|----|-----|------
|14 | 2| 22.2| 50.0| 2| 20.0| 50.0| 4| 21.1|100.0|
|----------------------|----|-----|-----|----|-----|-----|----|-----|------
|15 | 2| 22.2| 50.0| 2| 20.0| 50.0| 4| 21.1|100.0|
|----------------------|----|-----|-----|----|-----|-----|----|-----|------
|16 | .| .| .| 1| 10.0|100.0| 1| 5.3|100.0|
|----------------------|----|-----|-----|----|-----|-----|----|-----|------
|Total | 9|100.0| 47.4| 10|100.0| 52.6| 19|100.0|100.0|
--------------------------------------------------------------------------|
I have a Collection 'Col':
ID|Type|Type1|Type2|Count
1| a | a | b |2
1| b | a | b |1
2| d | b | d |2
2| b | b | d |2
3| x | y | x |0
3| y | y | x |1
I want to return a collection which contains for each unique ID, the possible types, the sum of each types count, and the individual count for each type
Ideally, the output should be:
ID|Type1|Type2|TotalCount|Type1Count|Type2Count
1 | a | b | 3 | 2 | 1
2 | b | d | 4 | 2 | 2
3 | y | x | 1 | 0 | 1
Currently, I do a groupBy and a Select on the collection:
Col.GroupBy(g=>new{g.ID, g.Type1, g.Type2}).Select(s=>new
{s.Key.ID, s.Key.Type1, s.Key.Type2, TotalCount = s.Sum(x=>x.Count),
Type1Count = s.Count(x=>x.Type == s.Key.Type1) //addition of individual count severely slows down query
Type2Count = s.Count(x=>x.Type == s.Key.Type2)// same here
}
);
As indicated above, the inclusion of Type1Count and Type2Count drastically increases the time the query would take without those columns. I have tried various other ways to get the value of the "Count" column from the initial Col table for each grouped row, but again...performance takes a big hit. Eventually the right results are returned though.
Is there an easier, better and or faster way to achieve the same results?
Any help is appreciated!