Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Karl-Heinz" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: Quick access to pretend fields Date: Tue, 14 Apr 2015 08:04:00 +0200 Lines: 65 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Trace: individual.net cD7wrPXTKr0jhuDtTSlGaAoQQ7dK5UuPfv2H9gh6nU90r2S9E= Cancel-Lock: sha1:L+FtgSqRCnZu8OfPE7NotAk5oZs= In-Reply-To: X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331 Xref: csiph.com comp.lang.clipper.visual-objects:7948 Hi Martin, i assume your field ( X_Field1 ) contains the "mm" value and that you want to receive the corresponding "inch" value on the fly - without any further DB structure changes. Than an option is to use a array that holds all the fields that must be converted. Using the base code below, oDB:Fieldget (#X_FIELD1) should give you either the "mm" or the "inch" value. ----------- DBF sample --------------- class dbMM inherit dbServer protect _aMMFields := {} as array ----------------------------- method init ( ... ) class dbMM _aMMFields := { #X_FIELD1 , #X_FIELD2 , etc. } super:Init ( ... ) ----------------- METHOD FieldGet ( uField ) CLASS dbMM local fValue as float // Check the global setting first. // In my apps i would use something like this IF GetAppObject():GlobalGet ( #VALUES_IN_INCHES ) IF ! Issymbol ( uField ) uField := self:fieldSym ( uField ) ENDIF IF ascan( _aMMFields , uField ) > 0 fValue := super:FieldGet ( uField ) // now calculate the "inch" value based on the given "mm" fValue ... ... return fValue ENDIF ENDIF return super:fieldget ( uField ) ------------------------ BTW . of course, FieldPut() must be changed according the described logic too. Keep in mind that it might be also neccessary to adjust the server methods NoIvarPut() and NoIvarGet(). regards Karl-Heinz