[progress Communities] [progress Openedge Abl] Forum Post: Re: Is It Safe To Use Properties...

Status
Not open for further replies.
G

gus

Guest
not always true. is for for each -- regards, gus (gus@progress.com) "If I set here and stare at nothing long enough, people might think I'm an engineer working on something." -- S.R. McElroy > On Feb 10, 2016, at 9:10 AM, Peter Judge wrote: > > Update from Progress Community [https://community.progress.com/] > > Peter Judge [https://community.progress.com/members/pjudge] > > Do you expect the value returned by the property to change between iterations? If so, you will run into problems since the WHERE only evaluates once. > > The test code below only displays one message in each case. > > def temp-table tt1 no-undo > > field f1 as dec > > field f2 as char. > > def var i as int. > > def var o as PropGet. > > do i = 1 to 100: > > create tt1. > > f1 = i. > > f2 = string(i). > end. > > o = new PropGet(). > o:GetterProp = 1.0. > o:NekkidProp = 1.0. > > for each tt1 where tt1.f1 = o:GetterProp: > > > o:GetterProp= tt1.f1 + 1. > > > message > > > 'tt1:' tt1.f1 tt1.f2 skip > > 'GetterProp' o:GetterProp skip > > 'can-find?' can-find(first tt1 where tt1.f1 = o:GetterProp) > > > view-as alert-box. > > end. > > message 'done GetterProp' > > > view-as alert-box. > > for each tt1 where tt1.f1 = o:NekkidProp: > > > o:NekkidProp = tt1.f1 + 1. > > > message > > > 'tt1:' tt1.f1 tt1.f2 skip > > 'o:NekkidProp' o:NekkidProp skip > > 'can-find?' can-find(first tt1 where tt1.f1 = o:NekkidProp) > > view-as alert-box. > > end. > message 'done NekkidProp' > > > view-as alert-box. > > And the PropGet class too > > class PropGet: > > > define public property GetterProp as dec no-undo > > get(): > > return exp(GetterProp, 2). > > end get. > > set. > > define public property NekkidProp as dec no-undo get. set. > > end class. > > View online [https://community.progress.com/community_groups/openedge_development/f/19/p/23007/80418#80418] > > You received this notification because you subscribed to the forum. To unsubscribe from only this thread, go here [https://community.progress.com/community_groups/openedge_development/f/19/t/23007/mute]. > > Flag [https://community.progress.com/community_groups/openedge_development/f/19/p/23007/80418?AbuseContentId=d6d180c3-3026-4bdf-b05d-51acb094b5d3&AbuseContentTypeId=f586769b-0822-468a-b7f3-a94d480ed9b0&AbuseFlag=true] this post as spam/abuse.

Continue reading...
 
Status
Not open for further replies.
Top