Parse text and look up ID based on result: Difference between revisions

From Starfish ETL
Jump to navigation Jump to search
(Created page with "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. <source lang="vb"> Function Scripted...")
 
No edit summary
 
Line 12: Line 12:
ls = Left(ls,InStr(ls,";")-1)
ls = Left(ls,InStr(ls,";")-1)
End If
End If
res = ls
Else
Else
res = XrefRead("sf-LeadSource",ls)
res = XrefRead("sf-LeadSource",ls)

Latest revision as of 17:53, 28 December 2017

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