Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #7947 > unrolled thread
| Started by | Martin <Martin@spam.spam> |
|---|---|
| First post | 2015-04-13 15:24 +0100 |
| Last post | 2015-04-14 16:36 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
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
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2015-04-13 15:24 +0100 |
| Subject | Quick access to pretend fields |
| Message-ID | <mggjgd$f95$1@dont-email.me> |
Hello all Got an edit screen, got reports, I want to connect them to the database through pretend fields. Real data in field X_Field1, but screens want to look at X_FieldX X_FieldX is NOT in the database but is a conversion of X_Field1 In this case it will be mm to inches and return, read m2 as foot2 and so on. What techniques will be the fastest to run and the fastest to alter screens with please? Thanks Martin
[toc] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2015-04-14 08:04 +0200 |
| Message-ID | <cp3pg9F7su6U1@mid.individual.net> |
| In reply to | #7947 |
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
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2015-04-14 16:36 +0100 |
| Message-ID | <mgjc3p$7og$1@dont-email.me> |
| In reply to | #7948 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web