I've got a loop, which is reading in a stack of XML files, for each one, it validates the data that was in the XML and loads it into some UDTs and then does some work on the data.
Then it gets back to the beginning of the loop and the UDTs still have data in from the previous XML. If that tag is defined in the new one, it overwrites, but if that tag isn't defined, then that element in the UDT is left alone.
But I can't reset the UDT by the technique I'd use for a variable (Let X = 0
) unless I go through every single element of the UDT and reset the value. And doing it object-style (Set X as New UDT
) doesn't work.
How do I do it?
Dim a new variable as the UDT and set the old one equal to the new variable.
For instance:
Dim XEmpty as UDT
X = XEmpty
Will reinitialise a variable X that is a UDT of type UDT.
You can use an empty utility function that simply returns the UDT
public function newTFoo() as TFoo
'//
end function
dim t as TFoo
t.x = 1234 ...
t = newTFoo()
'// t is reset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With