Search Address Fields Script

Trying to search the 3 address line fields for a key word to populate the ShipToCode and the ShipVia field.  Can I do this in one script or do I have to create a script for each search field?  This is what I got so far.

rVal = 0

sAddress = ""

sAddressa = ""

sAddressb = ""

searchString = "Terminal"



rVal = oBusObj.GetValue("ShipToAddress1$", sAddress)

rVal = oBusObj.GetValue("ShipToAddress2$", sAddressa)

rVal = oBusObj.GetValue("ShipToAddress3$", sAddressb)



If InStr(UCase(sAddress), UCase(searchString)) > 0 Or

	If InStr(UCase(sAddressa), UCase(searchString)) > 0 Or

		If InStr(UCase(sAddressb), UCase(searchString)) > 0 then

			rVal = oBusObj.SetValue(ShipToCode$, "GM")

			rVal = oBusObj.SetValue(ShipVia$, "SHIPHOLD")

		End If

	End If

End If

Parents
  • This script is giving me the same trouble I am having with some other Header scripts.  The script fires off and works if I am manually editing the fields the script is triggered off of, however these scripts are for orders that are being imported in through Insynch.  Is there something I can add to the scripts to get them to fire off?  I have it on a column-post-validate and also tried a table-pre-totals.

    rVal = 0
    nCustomerNo= ""
    sAddress = ""
    searchString = "Terminal"
    
    rVal = oBusObj.GetValue("CustomerNo$", nCustomerNo)
    rVal = oBusObj.GetValue("ShipToAddress1$", sAddress)
    
    If nCustomerNo = "0002000" then
    
    	If InStr(UCase(sAddress), UCase(searchString)) > 0 then
    		rVal = oBusObj.SetValue("ShipToCode$", "GM")
    		rVal = oBusObj.SetValue("ShipVia$", "SHIPHOLD")
    	End If		
    End If

  • in reply to jland47

    Have you tried to put them in the pre-write event?   Do you know if the scripts are even executing?  I am not familiar with InSynch's logic.  If they are using BOI, do you know if they turn off any scripting methods?  

    First thing I would do is see if the scripts are executing at all.  Then if the scripts are executing, you could try the pre-write event.

  • in reply to jepritch

    ROI changed the logic of the import to write the UDF's before the line details, as of now it looks like it solved my issue.

Reply Children
No Data