Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluate or Execute property

Status
Not open for further replies.

Gotheallblacks

Programmer
Oct 16, 2003
60
NZ
Is there a way to execute a property ? eg a property of a custom object which has a property called "qty" and it is the child of a parent custom object which also has a property called "qty" with a numeric value of say 5.

The child object property "qty" has a char value of "this.parent.qty*3" (char expression) and by executing the child property it returns the result of the "this.parent.qty*3" ie 15 to the childs.qty.value.






 

If I understand it correctly and if the value of this.childs.qty is character, you need to convert it back with
Code:
[COLOR=blue]WITH THIS
[tab].childs.qty = TRANS(.parent.qty * 3)
ENDW[/color]

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
Gotheallblacks,

If you want the Value property of the child to return teh evaluation of it's qty property then create a Value_Assign method for the child and in that method instead of returning the value...

Return Evaluate(this.qty)



boyd.gif

SweetPotato Software Website
My Blog
 
Thanks for your reply's. Because the child object(s) are being added at runtime and the child could belong to any of a number of parents. I couldn't use the parent name and use evaluate().
There are also several other properties of the child that needed evaluating and each child has different properties - Short story,I created a calc() method on the base child class and run it when required

LOCAL lcCmd AS String, lnProps AS Number, x ,laUDProps(1)
*!* Create array of user defined properties
lnProps=AMEMBERS(laUDProps,this,0,'U')
*!* Then Loop though each calculating its value
FOR x=1 TO lnProps
lcCmd=EVALUATE('this.'+laUDProps(x))
lcCmd='this.'+laUDProps(x)+'='+lcCmd
&lcCmd
x=x+1
ENDFOR

Thanks Geoff for pointing me in hopefully the right direction
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top