SiMX Help‎ > ‎The Target Platform‎ > ‎Objects‎ > ‎TARGET Object‎ > ‎

target.Update


Platform Objects


Description

This function updates value_to with value_from but only if value_from is not empty.  This efficient function replaces a lot if extra code as shown in the example.


Syntax


Function Update( value_to, value_from )


Parameters


value_to (input) - the variable that will be updated
value_from (input) - the value that, if not empty, will be placed into the variable

Return value


none


Example

Sample code

Function OnRecord
 
target.update v(1), target.strLib.mid(s, "DATE:\ *", " ")

Without the target.Update() function the code would look like this...

Function OnRecord
Dim s, c, i, p1, p2

s = DictIn.Field_1.value

SetByTag v(1),  s, "DATE:", " "

This.SkipRecord
End Function

Function SetByTag(ByRef val, s, t1, t2)
Dim p1, p2, d, r, c
r = Empty
d = Len(t1)
p1 = InStr(1, s, t1, 1) + d
If d = 0 Then p1 = 1
If p1 > d Then
    r = Trim(Mid(s, p1))
    If Len(t2) > 0 Then
        p2 = InStr(1, r, t2, 1)
        If p2 > 0 Then r = Trim(Left(r, p2 - 1))
    End If
    If Len(r) > 0 And Len(val) = 0 Then val = r
End If
End Function


See also

Platform Objects and Methods
target.TimerSet
target.Validate
Target Methods