Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: CrystalReports
friendz am stuck at a point that in crystal Crosstab report, i need to have sum of only two column's value and subtract the total by the value what should i do?
 
as in below,
 
                   Product 1    Product2    Product 3    Total
                   ----------------------------------
           Cust 1      4           5           2          11
           Cust 2      5           9           7          19
 
I want to sum values of "Product 1","Product 3". then subtract from row total=> Total LIKE [4+2]-11=>TOtal. and want to repeate this for each customer..
 
the way which I using to solve is.....[this is basicly C.R formating Display String Formula with VB Syntax]
 
Global totprodsum as int
 
Global Ccust As String 
Dim Ldept As String 
Whileprintingrecords
if (Ccust="") then
    totprodsum=0
    totprodsum=totprodsum+currentfieldvalue
    Ccust=gridrowcolumnvalue("Table_Customer.Name")
    formula=currentfieldvalue
else
    if Ccust<>gridrowcolumnvalue("Table_Customer.Name") then
        totprodsum=0
        totprodsum=totprodsum+currentfieldvalue
    else
        totprodsum=totprodsum+currentfieldvalue
        formula="Newag"
    end if
formula=currentfieldvalue
 
end if
 
Ccust=gridrowcolumnvalue("Table_Customer.Name")
 
but its not working bacause Crystal report generates report in this sequence
 
Cust 1 <1st col value>
 
then.....
 
Cust 2 <1st Col Value>
 
then..........
 
Cust 1 <1st col value> <2nd Col Value>
Cust 2 <1st Col Value>
 
then ....
 
Cust 1 <1st col value> <2nd Col Value>
Cust 2 <1st Col Value> <2nd Col Value>
 
then .....
 
Cust 1 <1st col value> <2nd Col Value> <3rd Col Value>
Cust 2 <1st Col Value> <2nd Col Value>
 
then..
 
Cust 1 <1st col value> <2nd Col Value> <3rd Col Value>
Cust 2 <1st Col Value> <2nd Col Value> <3rd Col Value>
 
while I want crystal report to Execute report like this
 
Cust 1 <1.1> <1.2> <1.3>
 
then......
 
Cust 2 <2.1> <2.2> <2.3>
 

anyone please help me out.
Posted 14-Apr-13 22:48pm
Edited 15-Apr-13 2:46am
v3
Comments
Aarti Meswania at 15-Apr-13 4:25am
   
you mean yo have product 1 & 3 and total now you want to find value of product2???
wajahatabdi at 15-Apr-13 7:37am
   
I want to sum values of Prod1 & prod3 and then subtruct them by Total
Maciej Los at 15-Apr-13 16:12pm
   
Still not clear...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 15 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100