Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #7952

Re: Quick access to pretend fields

From Martin <Martin@spam.spam>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Quick access to pretend fields
Date 2015-04-14 16:36 +0100
Organization A noiseless patient Spider
Message-ID <mgjc3p$7og$1@dont-email.me> (permalink)
References <mggjgd$f95$1@dont-email.me> <cp3pg9F7su6U1@mid.individual.net>

Show all headers | View raw


Thanks for the advice, I will have a good look through this

martin

On 14/04/2015 07:04, Karl-Heinz wrote:
> 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 | Find similar | Unroll thread


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