using crystal report 7
Single report (no sub report added, group by id)
ID Value total
001 100 2000
001 200 3000
-------------
total 300 5000 (a)
002 300 1000
002 200 2000
-------------
total 500 3000 (b)
003 300 1000
003 200 2000
-------------
total 500 3000 (c)
......
I have n number of subtotal like a, b, c ....., each subtotal i want to make subtotal2/ subtotal1 like b/a, c/a .....
Expected Ouput
ID Value total subtotal
001 100 2000
002 200 3000
-------------------
total 300 5000 0
002 300 1000
002 200 2000
-------------------
total 500 3000 0.6
003 300 1000
003 200 1000
-------------------
total 500 2000 0.4
......
How to do it in crystal report.
Can any one give me a idea or formula help
Forgive me, as I have not worked with a version of Crystal that old, but hopefully at least one of these solutions will be suitable:
Create a subreport in the report header which will pull the total of group a. Create a formula along the lines: shared numbervar total_a := sum({table.total});
In the main report group footer add a formula along the lines: shared numbervar total_a; sum({table.total}) / total_a;
OR similar to the above solution:
Create a formula in the report header: global numbervar total_a := 0;
Create a formula in the group footer: global numbervar total_a; if total_a = 0 then total_a := sum({table.total}); sum({table.total}) / total_a;
Related
Table Tab
minThreshold
maxThreshold
point
1000
10000
10
wClause,:enlist((';~:;<);`qty;Tab[`minThreshold])
trying to incorporate maxThreshold column to where clause
qty >= MinThreshold
qty <= MaxThreshold
something like
wClause,:enlist((';~:;<);`qty;Tab[`minThreshold]);Tab[`maxThreshold])
q)Tab:([] minThreshold:500 1000;maxThreshold:700 2000;point:5 10)
q)Tab
minThreshold maxThreshold point
-------------------------------
500 700 5
1000 2000 10
q)select from Tab where minThreshold>=900,maxThreshold<=2500
minThreshold maxThreshold point
-------------------------------
1000 2000 10
q)parse"select from Tab where minThreshold>=900,maxThreshold<=2500"
?
`Tab
,(((';~:;<);`minThreshold;900);((';~:;>);`maxThreshold;2500))
0b
()
q)?[Tab;((>=;`minThreshold;900);(<=;`maxThreshold;2500));0b;()]
minThreshold maxThreshold point
-------------------------------
1000 2000 10
See the whitepaper for more information on functional selects:
https://code.kx.com/q/wp/parse-trees/
Is your problem
you have a Where phrase that works for functional qSQL and you want to extend it?
you want to select rows of a table where the value of a quantity falls within an upper and lower bound?
If (2) you can use Join Each to get the bounds for each row, and within to test the quantity.
q)show t:([]lwr:1000 900 150;upr:10000 25000 500;qty:10 1000 450)
lwr upr qty
---------------
1000 10000 10
900 25000 1000
150 500 450
q)select from t where qty within' lwr{x,y}'upr
lwr upr qty
--------------
900 25000 1000
150 500 450
Above we use {x,y} because in qSQL queries comma does not denote Join.
i have following records in crystal report
ID Number Status
1 001 En
2 002 En
3 003 Suc
4 004 En
exacted output
ID Number Status
1 001 En
2 002 En
3 003 Suc
4 004 En
Total En= 3
Total Suc= 1
i want to count Total in Report Footer .use below formula but not work
if({sp;1.Status} = "En") then
count({sp;1.ID})
Formula doesn't work this way. try this:
create two more formula calen and calsuc and place to the side of the status in details and suppress both:
calen
if({sp;1.Status} = "En") then
1
else
0
calsuc
if({sp;1.Status} = "suc") then
1
else
0
Now take the summary of both the formulas in report footer and display as you like
I'm working in Crystal Report 2008, And I have a data with like this:
Date KG MT SQM
--------------------------------------------
01-01-2013 25000 25
01-01-2013 15000 15
01-01-2013 15000 15 -----(duplicated)
01-02-2013 13000 13
01-02-2013 12000 12
01-03-2013 18000 18
01-03-2013 33000 33
Then I tried to group it by date so the output is like this: so it's already removed the duplicated and sum the vlaue without a problem.
Date KG MT SQM
--------------------------------------------
01-01-2013 40000 40 55000
01-02-2013 25000 25 25000
01-03-2013 51000 51 51000
TOTAL 116,000 116 131,000
Then I want to add the SQM, and when I sum it, it will sum all the record in the group also with duplicated record.
(if you will sum the 3rd field, it also included in sum the duplicated record should be only '116,000' and not '131,000')
My question, how can I suppressed if duplicated and at the same time it will give me summary of the group to show the correct value?
Thanks,
Captain16
using crystal report 7
ID Value total
001 100 2000
002 300 1000
003 300 1000
......
i want to add one more additional row at runtime after 2nd row (1st + 2nd row).
Expected Ouput
ID Value total subtotal
001 100 2000 (a)
002 300 1000 (b)
123 400 3000 (total of a & b)
003 300 1000 (c)
......
How to do it in crystal report.
Can any one give me a idea or formula help
Create a new formula field: if recordnumber in [1,2] then 1 else 2;
Create a group using this formula
Suppress the group header
Conditionally suppress the group footer using formula recordnumber > 2
Add your total fields to the group footer
Using Crystal Report 7
ID Value
001 100
002 200
003 400
004 500
...
I have n number of row, from that i want to sum of value from 003 to n, i don't want to sum of 001 and 002.
In a report footer, i need to add sum of value from 003 to n.
How to create a formula for the above condition, Need formula help
You can use the same solution as: How to add rows at runtime
Create a new formula field: if {table.id} in ['001', '002'] then 1 else 2;
Create a group using this formula
Suppress the group header
Add your total fields to the group footer (you will get a total of 001 + 002 then a total of 003... n