Add On to Script

SOLVED

I have a script looking at misc items, item type =5, any item with this type the qty ordered is populated into an UDF with the equal amount.  One exception is if the item code is /SMISC, then nothing is populated, the UDF stays = 0.  I need to enter another variable, that if the item code STARTS with "/C-ACT...." to also leave the UDF = 0.  I tried using an "Instr" statement, but not sure I am using it correctly or do I need to create a separate script for this instance?  The /C-ACT is always caps, that's why I didn't use UCASE.  I also tried entering > 0, <> 0 after the Instr statement.

rVal = 0
sItemType = ""
nQTY = 0
sItem = ""
searchString = "/C-ACT"

rVal = oBusObj.GetValue("ItemType$", sItemType)
rVal = oBusObj.GetValue("QuantityOrdered", nQTY)
rVal = oBusObj.GetValue("ItemCode$", sItem)

if sItemType = "5" then

		if sItem <> "/SMISC" OR InStr(sItem, searchString) then

		rVal = oBusObj.SetValue("UDF_QTY_PULLED", nQTY)

		end if
	
	

end if

Parents
  • +1
    verified answer


    From what you describe, you want both conditions to be false:

    > ItemCode$ not equal to "/SMISC" AND ItemCode$ does not start with "/C-ACT"

    so you will need to 'AND' the conditions, not 'OR' them.

    if (sItem <> "/SMISC") AND (InStr(sItem, searchString) <> 1) then
    
    	rVal = oBusObj.SetValue("UDF_QTY_PULLED", nQTY)
    
    end if
    

    Hope this helps,

    Russell

Reply
  • +1
    verified answer


    From what you describe, you want both conditions to be false:

    > ItemCode$ not equal to "/SMISC" AND ItemCode$ does not start with "/C-ACT"

    so you will need to 'AND' the conditions, not 'OR' them.

    if (sItem <> "/SMISC") AND (InStr(sItem, searchString) <> 1) then
    
    	rVal = oBusObj.SetValue("UDF_QTY_PULLED", nQTY)
    
    end if
    

    Hope this helps,

    Russell

Children