calculate available stock

Hello,

i want to add a field in my MGB screen that contain avaible stock , so i added a field type QTY but i have no idea how to write function in spe script that calculate availble stock !!!!!

please help!!

i'm under X3 V11