Scripted Value: Difference between revisions

From Starfish ETL
Jump to navigation Jump to search
(Created page with "Scripted Value fields allow for extreme flexibility when assigned values to a Destination field. Basically, any function that can be performed with VB Script can be performed...")
 
No edit summary
 
Line 4: Line 4:
Below are a few examples of how Scripted Value fields can be used.
Below are a few examples of how Scripted Value fields can be used.


Samples
 
''Samples''
{| class="wikitable"
{| class="wikitable"
! Return the Current Date/Time
! Return the Current Date/Time

Latest revision as of 20:05, 5 November 2014

Scripted Value fields allow for extreme flexibility when assigned values to a Destination field. Basically, any function that can be performed with VB Script can be performed within a Scripted Value field. Variables can also be referenced from within the script.


Below are a few examples of how Scripted Value fields can be used.


Samples

Return the Current Date/Time Return the left-most 5 characters from “ZIPCODE” Origin field
Function ScriptedField

ScriptedField = Now()

End Function

Function ScriptedField

Dim var

var = "@@ORG:ZIPCODE@@"

ScriptedField = Left(var,5)

End Function

Trim an Origin field Return different values, based on a Variable value
Function ScriptedField

Dim var

var = "@@ORG:TYPE@@"

ScriptedField = Trim(var)

End Function

Function ScriptedField

If "@@VAR:vMyVariable@@" = "" Then

ScriptedField = "Value 1"

Else

ScriptedField = "Value 2"

End If

End Function


Press the button to test the results of your script. Keep in mind, this will not replace variable values.