Function for incoming and outgoing Orders [Solved]


Hello community,

i want to create a base that controlls orders. I have one table for “order positions” and one for orders. In the orders table i have a column for In/Out. Im looking for a funktion that adds or subtrakts the amount of items in storage based on “In/Out” column so i only need to use positive numbers.
I was looking through the funktions but dont know what do use. i was thinking about the replace funktion with an if statement and multiplay by the amount. like IF( “In” =1), IF(“Out” = -1) * Amount.
I know this code isnt correkt but i have no clue how to do it.

Edit: Problem partially solved by IF({IN/OUT} = “OUT”, -1) * Amount, but i donkt know how to make an ELSE statement



The syntax is IF(Condition, Do, ElseDo), so:

IF(Type = 'In', 1, -1)



Thank you for your reply.
i have done it that way :slight_smile: