0

Active field after update

Hello

There is a field for a barcode, and when I scan, the product is automatically added to the cart and the field is cleared, but for the next scan the field is active, I tried many commands, but they don't work in Ninox, for example "focus"
What command is there in ninox so that Trigger after update, because that is where the formula for the scanner is written, the field becomes active? After scanning, the product automatically goes to the basket and the field is cleared.
The formula that is used now

let scannedCode := trim(this.BarcodeField);
let foundProduct := first(select Products where Barcode = scannedCode);
let openInvoice := this;
let client := openInvoice.Clients;
let clientName := client.User;
let clientDiscount := client.Discount;
let productDiscount := foundProduct.Discount;
let maxDiscount := max(productDiscount, clientDiscount);
let finalPrice := foundProduct.Price * (1 - maxDiscount / 100);
let existingProduct := first(Sales_tab[Products = foundProduct]);
if openInvoice.CartClosed = 2 then
    alert("Добавление товара в корзину запрещено, корзина закрыта.")
else
    if existingProduct != null then
        existingProduct.(Quantity1 := existingProduct.Quantity1 + 1);
        existingProduct.('Discount Price' := finalPrice)
    else
        let newSailTab := (create Sales_tab);
        newSailTab.(Products := foundProduct);
        newSailTab.(Quantity1 := 1);
        newSailTab.(Sales := openInvoice);
        newSailTab.('Discount Price' := finalPrice)
    end
end;
if BarcodeField != "" then BarcodeField := "" end

It works correctly, but the field after scanning remains inactive, and is not ready to scan a new product

Thank you all and happy new year

Reply

null