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
Related
I need to concatenate the rows(taille). for example, for the code_commande 001 and code_article=1, I need to concatenate in list all taille which have these two conditions. another example, for code_commande=001 and code_article=2, the same job I need to concatenate in a list all taille which have these two conditions. this for all
code_commande code_article taille
001 1 s
001 1 m
001 1 xl
001 1 x52
001 2 m
001 1 5566
001 2 x52
001 1 xl
002 1 s
002 2 m
001 3 xxl
002 3 xs
001 1 ml
001 1 xs32
I need to concatenate taille for each code_commande for each code_article
example of result:
001 1 s,m,xl etcc
dynamically
I should have a table who grouped the ( taille) for each code_commande for each code_article like:
001 1 s,m,xl,
001 2 s,xl,l
002 1 xs,ettcc
I have tried this query but ,it concatenate all (taille) for all rows
the query
Select [code_commande],[code_article], SUBSTRING(
(
SELECT ',' +[taille] AS 'data()'
FROM [dbo].[commande] FOR XML PATH('')
), 2 , 9999) As taille_commande
from [dbo].[commande]
order by [code_article],[code_commande]desc
As mentioned, STRING_AGG() is your friend for this requirement. Assuming your original post contained the schema you're working with, a simple aggregate query will give you the results you want.
select code_commande, code_article, STRING_AGG(taille, ',') as taille_commande
from dbo.commande
group by code_commande, code_article
STRING_AGG reference
Note this is only available in SQL Server 2017+ and azure. To see a possible solution for previous versions, see this duplicate.
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
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 Name
001 Raja
002 Vijay
003 Suresh
004 Mahes
005 Salma
I want to arrange by id (003, 001, 004, 002, 005)
Expected output
ID Name
003 Suresh
001 Raja
004 Mahes
002 Vijay
005 Salma
Note: Maximum row is 5 only, it will not exceed more than 5.
I need to add 5 group or any other method is there for arranging the rows.
Need Crystal report formula or suggestion help
In later versions of crystal you can set a custom sort order but if this feature isn't available in CR7 you should be able to create a formula:
if {table.id} = '003' then
1
else if {table.id} = '001' then
2
else if {table.id} = '004' then
3
else if {table.id} = '002' then
4
else if {table.id} = '005' then
5
else
999;
Then sort on that formula.
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;