formula creates a record ( which i don't need)
Hi all!I am stuck with the formula
can you check what is wrong?
what i want to achieve :
if user creates a new order to seller and there is already an order to this seller (with status: undelivered) – then add lines to the existing order.
let t := this;
let postav := t.seller;
let z := (create ‘order');
let same := cnt((select ‘order')[’status' = 1 and ’seller' = postav]) != 0;
let selectsame := (select ‘order')['status' = 1 and 'seller' = postav].Id;
if postav = 1 and same then
t.('order' := last(selectsame))
end
– Now it’s adding lines to the existing order, but creating a new empty order (i can't figure why???)
=
– if i delete “last” from last code line before the end – it will say ‘it returns with multiply values’ (why? i even pointed the Id or the order record )
2 replies
-
Hi,
this line: **let z := (create ‘order');** creates a new order.
Try to move this line after the if statements.
-
oh hell! the truth was so close! thank you @Nick
Content aside
- 5 yrs agoLast active
- 2Replies
- 1080Views