Hi everyone!
I have Master and Detail tables...
Master:
Year
Month
Detail:
Year
Month
OtherDetailFields (not relevant for this problem)
.
.
.
I defined recDetail Record variable in Master table which points to Detail table and I want to delete detail records in OnDelete trigger of Master table. Which of following solutions should I use:
recDetail.SETRANGE(Year, Year);
recDetail.SETRANGE(Month, Month);
recDetail.DELETEALL;
or this:
recDetail.SETRANGE(Year, Rec.Year);
recDetail.SETRANGE(Month, Rec.Month);
recDetail.DELETEALL;
or this:
recDetail.SETRANGE(recDetail.Year, Rec.Year);
recDetail.SETRANGE(recDetail.Month, Rec.Month);
recDetail.DELETEALL;
All of them work but which is considered a "Best practice"?
Thanks!
0
Comments
I always select the field in the object browser's field list, and then I manually type SETFILTER( or SETRANGE(.
RIS Plus, LLC
You mean "recDetail.Year.SETRANGE("
Wouldn't that require defining additional FieldRef variable?
I look up the field in the object browser and select the one I need: Then I put the cursor right after the dot (CTRL+Arrow left) and type: Then I move the cursor to the end (end key) and type the filter criterium:
That's how I do it. You don't need the MyRec reference, since that is already set with the SETFILTER. I do like to explicitly put the other rec variable reference in there, it is just more readable for me.
RIS Plus, LLC
RIS Plus, LLC
I agree WITH you
Thanks for explanations!