Friends, I have a form that SALIDAS tools according to CODIGO, but these have a unique QR. In the ARTICULOS table, only the quantity is recorded per CODIGO and the QR is only for reference of the tool. When registering the SALIDA, the quantity must subtract the amount of the ARTICULO by CODIGO, but the Bot and the action that I have implemented, gives me wrong results. For example, if I make the SALIDA of CODIGO=BODCAL001 QR=123 CANTIDAD=01 in one line, in the other line CODIGO=BODCAL001 QR=456 CANTIDAD=01 in another line CODIGO=BODCAL001 QR=789 CANTIDAD=01 the result is (- 2) being that the quantity of ARTICULO BODCAL001 was 4.
These are the expressions:
BOT RESTA, Data change, Table SALIDAS, Data change type Adds and Updates, Condition = “”
PASO RESTA, Run action on rows, References Table ARTICULOS, Referenced rows=FILTER(“ARTICULOS”,([CODIGO]=[_THISROW].[CODIGO])), Referenced Action RESTA.
Action RESTA, For a record of this table ARTICULOS, Do this Data: set the values of some in this row, Set these columns CANTIDAD TOTAL= ([CANTIDAD TOTAL] - SUM(SELECT(SALIDAS[CANTIDAD], [CODIGO] = [_THISROW].[CODIGO])))
Please help me to know what mistake I am making. My job depends on this application. Thank you.