Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #7948
| 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" <invalid@invalid.invalid> |
| 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 | <cp3pg9F7su6U1@mid.individual.net> (permalink) |
| References | <mggjgd$f95$1@dont-email.me> |
| 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 | <mggjgd$f95$1@dont-email.me> |
| 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 |
Show key headers only | View raw
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
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Quick access to pretend fields Martin <Martin@spam.spam> - 2015-04-13 15:24 +0100
Re: Quick access to pretend fields "Karl-Heinz" <invalid@invalid.invalid> - 2015-04-14 08:04 +0200
Re: Quick access to pretend fields Martin <Martin@spam.spam> - 2015-04-14 16:36 +0100
csiph-web