I think I must be missing something.
Scenario: It's renewal time at our club. I need to apply next year's charges to members accounts. There is the usual membership subscription but certain members rent caravan sites and trailer sites for their gliders.
I have a BO called Sites and each instance has a reference attribute called Site.Payer linked to the members file. I have a spyhole into the members BO so I know for sure that my test member has a caravan site and a trailer site for which he is responsible for the payment of.
The following code was supposed to create two transactions - 1 for the caravan and one for the trailer
FIND Sites WHERE Members IN Sites.Payer (The test member was put in context earlier)
CREATE Transactions FOR EACH Sites WITH Transactions.Description=Sites.Site_Type+' '+Sites.Site_ID,Transactions.TXType='Charge',Transactions.Qty=1,Transactions.Price=NEG(Sites.Annl_Fee),Transactions.Nett=NEG(Sites.Annl_Fee)
What it actually gave me was 2 trailer transactions which coincidentally was the first record I set up
Charge Trailer T24 -235.00 08/01/2010
Charge Trailer T24 -235.00 08/01/2010
So it seems that whilst the correct NUMBER of transaction has been created, the data does not change as I wanted as it looped through the in-context sites
What have I done wrong - or have I misunderstood what FOR EACH is supposed to do