If you want to loop as before:
STORE m.tuValue TO (" toSavedObject." + m.tcProperty )
but as you are already given the name:
STORE m.tuValue TO (m.tcObjectName + "." + m.tcProperty )
should be the fastest option performancewise, as you do not have get object reference first.
BTW: no need to loop,
toSavedObject = eval(m.tcObjectName)
should do the trick faster, as no loop is involved.
Alternatively you could
= addproperty(toSavedObject, m.tcProperty, m.tuValue)
which also needs the resolving to a reference up front, will overwrite existing properties and also create the ones not already on the object
>Hi all,
>
>This is probably a "Friday afternoon brain fart" type of thing but coding a utility class that has a function where I pass in:
>
>tcObjectName
>
>tcProperty
>
>tuValue
>
>That is, I want to have a generic function that assigns a value to a property of an object. I first loop through a collection to get an object reference to the named object to yield toSavedObject
>
>I know this works:
>
>
>
>STORE tuValue TO toSavedObject.&tcProperty
>
>
>
>Is there any other way to get the value into the property without using the ampersand?
>
>I tried indirection but that did not work e.g.
>
>
>
>STORE tuValue TO ( toSavedObject + "." + tcProperty )
>
>
>
>I know I can keep trying but figure I would ask and maybe there would be an answer when I get in Monday morning :-)
>
>Thanks,
>
>Albert