If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Crystal Reports > Complex Cystal Report Formula

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Apr 2011
Posts: 6
Complex Cystal Report Formula

Hi,

I need this kind of report...

101 UNAIDS 10 10
ER 2 8
ET 4 4

102 WHO 10 14
ER 4 10
ET 2 8


What happens is UNAIDS first gave 10 items. The donation is identified by 101 (incominginovoiceid). THe next 10 is the balance. Since it was the first donation, the balance is the same.

Then from those 10 items given, ER took 2 items. So we have 8 in store. Then ET took 4 from the 8 items. So, we have 4 in store.

Then WHO gave 10 items. Now since we had 4 items in store already [the 4 left from UNAIDS], the balance is 14. Now from the 14, ER took 4 so we remain with 10. FRom this 10, ET took 2 so we end up with 8.

I have used group headers to group them as in the above and it looks great. My approach was to create a forumula that would sum up total items taken in single batch first (i.e. 4 +2=6 for first, then again 4+2=6 for second), subtract from balance of that specific batch. So, the formula gave 6 for first batch which is correct. While for the second one it gave 6 as well which is wrong. It gave 6 because the balance is 10, not 14.

NOw, back to my question, how can i pass the remaining items from previous batch to the batch that is following? I.E. the 6 items of UNAIDS to the 10 newly WHO-donated items?

here is the method i tried but failed...

Code:
SHARED numberVar looper=0;

SHARED numberVar totalTaken;

SHARED numberVar pretotalTaken;

SHARED numberVar activein;

GLOBAL numberVar prein=0;

SHARED stringVar k;



WhilePrintingRecords;

if recordnumber=1 then
(

activein:={DSSMP_RPT_StockItem;1.incominginvoiceid};

prein:=0;

totalTaken:={@remainItems};
 //@remainITems is the formula that calculates total remaining items 
ToText({DSSMP_RPT_StockItem;1.originaltotal});

 //first record. so the balance is same as the exact no of items donated
)

else (
 //row contined.
if prein<>activein then (
 //if dealing with different donation
prein:=activein;

ToText({@remainItems} + {DSSMP_RPT_StockItem;1.originaltotal});


//originaltotal is the total donated for that specific donation
)




)
i kno it is a lot to ask but can u give me some insight on how to do this.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On