Select linked records
I try to carry out an annual sales inventory. To do this, I create a loop on my products [Media] and, for each one, I look for sales for the year.
I can“t select the sales for each product... probably a misunderstanding of the syntax.
Here is the code of the button used to create the subrecords of the yearly inventory :
let xCurrRec := ID;
let xYear := Year;
”// Select Medias ready for inventory //“;
for i in select Medias where text(Step) = ”Inventaire“ do
”// Create a subrecord for each Media //“;
let x := (create Inventory_line);
x.(Annee := xYear);
x.(Medias := i);
”// Sum the yearly sales of the current Media //“;
let xSales := sum((select Sales where Media=i and year(Invoice.Date) = xYear).Nb);
x.(Nb_Sales := xSales);
end
Thank you for any help!
1 reply
-
Solved (bad naming...)
Content aside
- 4 yrs agoLast active
- 1Replies
- 440Views