This function splits a value (param 1) based on a delimiter (param 2) and sets the resulting value to a variable at the current DCO level (param 3). This function will only return the value to the right of the rightmost instance of the delimiter. I.e if param1=tm00001.xls, param2=".", param3=ext, then the value "xls" would be added to a variable called "ext" at the current DCO level.
'Returns: True if non empty value added to variable, false otherwise
'Level: Any
<f name="SplitValueRight" access="public">
<p name="toSplitParam"/>
<p name="delimParam"/>
<p name="outputVarParam"/>
<g><![CDATA[
Dim toSplit
Dim result
Dim pos
SplitValueRight = false
toSplit = MetaWord(toSplitParam)
Writelog("toSplit after MetaWord: '" & toSplit & "'")
pos = InStrRev(toSplit, delimParam)
Writelog("pos: '" & pos & "'")
pos = Len(toSplit) - pos
Writelog("len - pos: '" & pos & "'")
result = Trim(Right(toSplit, pos))
WriteLog("result of split: '" & result & "'")
CurrentObj.Variable(outputVarParam) = result
if(CurrentObj.Variable(outputVarParam) <> "") then
WriteLog("Value successfuly added to '" & outputVarParam & "' on current object: '" & result & "'")
SplitValueRight = true
end if
]]></g></f>