UDF Calculation

SOLVED

Hello

I want to calculate UDF H, W & D to Volumn Field to get the cubic feet of item:  (H x W x D)/1728. The following formula doesn't work on a prewrite UD script setting. I appreciate help from you expert. Thanks :)

H = 0
W = 0
D = 0
CF = 0

retVal = oBusObj.GetValue("UDF_ID_H", H)
retVal = oBusObj.GetValue("UDF_ID_W", W)
retVal = oBusObj.GetValue("UDF_ID_D", D)
retVal = oBusObj.GetValue("Volume", CF)

if (CF) = isnull then retVal = oBusObj.SetValue("Volume", 0) else if (CF) = 0 then retVal = oBusObj.SetValue("Volume", 0) else retVal = oBusObj.SetValue("Volume", (H*W*D)/1728)

Parents
  • 0

    CF will never be null, and I expect you have structural issue.  UDS maintenance has a syntax check to be sure.

    Add MessageBox pop-ups (or use debug prints) to check your progress as you test the script, so you can ensure it's running, getting correct values from each field, and where in your conditional statement the logic flows.

  • 0 in reply to Kevin M

    The syntax check past. I used the Volume field on CI Item as CF (Cubic feet). The field need to manually enter. I want to caclulate the UDF fields H W D / 1728 and get the value enter to "Volumn automatically. See screenshot below. Thanks much if any one can help.

Reply Children