>Hi,
>
>I may have asked this before, my apologies if I have, but I can't work out how to do this.
>
>I have a Receipt BO and a ReceiptDetails BO which is a child of the Receipt BO. For data entry validation, the user has to enter a total amount received at the Receipt BO level and then the sum of the amounts entered at the Receipt Detail BO level must equal the Receipt BO's total amount received.
>
>How should I approach writing such a Business Rule?
>
>I guess it should be at the Receipt BO level, but how would I refer to the child BO to sum all the amounts?
Frank,
You could do as Bob suggested by passing the child dataset into your Reciept business object. On the other hand, since this is not during a save it really is just form level validation and you could keep a running total in a form variable to continue matching against. Don't let them save until there is a balance if you don't want to. Unless you are going to check this at the save which would make sense, then return a broken rule if the two are not in balance.
Passing in the *proposed* child dataset may depend on where it is. Do you have that in a grid?
Tim
Timothy Bryan