Parse text and look up ID based on result

From Starfish ETL
Jump to navigation Jump to search

This script parses out the first Lead Soruce from a comma or semi-colon seperated list and then gets the Lead Source ID from an xRef list.

Function ScriptedField
	Dim ls
	Dim res
	ls = "@@ORG:CUSTOM07@@"
	If Len(ls) <> 2 Then
		If InStr(ls,",") > 0 Then
			ls = Left(ls,InStr(ls,",")-1)
		End If
		If InStr(ls,";") > 0 Then
			ls = Left(ls,InStr(ls,";")-1)
		End If
		res = ls
	Else
		res = XrefRead("sf-LeadSource",ls)
	End If
	ScriptedField=res
End Function