Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Can I mimic a "currency" data type when field defs are read into Delphi.
Thu, Jan 27 2011 6:42 AMPermanent Link

Adam Brett

Orixa Systems

I don't tend to work too much on GUI. I try to let the my application framework do as much work as possible.

So usually I don't design forms or user GUI, I have systems which read the incoming structure of the data-types of the data and create edits that will "look nice".

In DBISAM I could choose Currency data-type for currency fields & Float data-type for other accurate numbers. the GUI then knows (without me asking) to put the relevant currency symbol & formatting around the data, and have appropriate editor capabilities for that type of field (calculator drop-downs etc.)

In ELEVATE we don't have a currency type. We have FLOAT, DECIMAL & DOUBLE PRECISION.

Previously I was writing code:

 case Fields[i].datatype of
  ftFloat : dosomething;
  ftCurrency : dosomethingelse;
 //... etc
  end;

.... is there a way of picking up the  difference between  FLOAT, DECIMAL & DOUBLE PRECISION in code?
Thu, Jan 27 2011 8:50 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Adam


Tim or someone else may be able to give you a better answer but mine would be to stop using Fields and start using the data stored in the catalog. As a half way house what you could do is check the actual datatype according to ElevateDB where there is some confusion.

eg


SELECT Type FROM Information.TableColumns WHERE TableName = 'xyz' AND Name = 'ABC'


Roy Lambert [Team Elevate]
Thu, Jan 27 2011 1:34 PMPermanent Link

Adam Brett

Orixa Systems

Great idea Roy, It would be a simple function call in my Delphi DB pas code & I could then (I assume) access types like DECIMAL etc. & use these to determine my GUI. Could also write special code to present COMPUTED fields in a nice way ... uuum.

Thanks
Thu, Jan 27 2011 5:16 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< In DBISAM I could choose Currency data-type for currency fields & Float
data-type for other accurate numbers. the GUI then knows (without me asking)
to put the relevant currency symbol & formatting around the data, and have
appropriate editor capabilities for that type of field (calculator
drop-downs etc.) >>

I would use the DECIMAL type for all currency columns.  That will allow you
to keep doing what you're doing in Delphi code, but instead of ftCurrency,
just look for ftBCD.  You could keep any DOUBLE columns with the ftFloat
check.

--
Tim Young
Elevate Software
www.elevatesoft.com
Fri, Jan 28 2011 5:13 AMPermanent Link

Adam Brett

Orixa Systems

Thanks Tim,

That way I only have to change 5 characters in the code & I keep the functionality, excellent!

Adam
Image