Create a formula that replicates the column 'pcs of candy' but returns zero if the row is less than the Nth.
A posible formula could be (VB syntax):
WhileReadingRecords
Global Counter as Number
If Counter + 1 > NthRow Then
formula = {pcs_of_candy}
Else
formula = 0
End If
Counter = Counter + 1
Replace NthRow with your value and {pcs_of_candy} with the exact name of the field. Place the formula in detail section and hide it.
Create a Summary field and choose the formula you've created as a field to summarize. You should get the correct total.
Joined: 20 Nov 2017
Online Status: Offline
Posts: 3
Posted: 10 Jan 2018 at 3:48am
Thank you. This is similar to what I had tried previous to asking the question. It's a very simple problem, so i was surprised my efforts did not work until now. For some reason the crystal syntax or maybe missing the "WhileReadingRecords" caused it to not work. In any case, I figure I would share my code.
The actual problem was to charge customers a 4% fee only after the tenth order they've placed.
/////////////////////////////
WhileReadingRecords;
//How many orders are free
Global numberVar freeOrders;
freeOrders := 10;
//Fee percentage
Global numberVar orderFeePercentage;
orderFeePercentage := .04;
//Count number of orders so far and iterate++
Global numberVar rowCounter;
rowCounter := rowCounter + 1;
IF rowCounter > freeOrders
THEN {@salesLessDiscountsLessMisc}*orderFeePercentage
ELSE 0
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum