using AsInteger in a Float Field lazarus / 16-Databases ---------------------------------------------------------------------- Weitentaaal · 2021-07-21 09:17 Hello so i was wondering what happens if u take value of Float Field in Database by using Fieldbyname.AsInteger. Does AsInteger Round ? or trunc ? does an error occur ? ---------------------------------------------------------------------- devEric69 · 2021-07-21 09:29 As_xxx are TField's methods that transtype internally. In TField.As_xxx, xxx means, indicates the type of data we provide (when it is an assignment, i.e. aField.As_xxx:= x;). So, the field knows, then, if it should transtype x before its effective storage (in accordance with its true type). And for the opposite, it's simply asking the TField to transtype its internal type towards an external typed variable. So yes: when asking for the value with AsInteger (your question), the TFloatField should round its native real value towards the nearest integer. ---------------------------------------------------------------------- Weitentaaal · 2021-07-21 13:08 ThnaQuote from: devEric69 on July 21, 2021, 11:29:50 amAs_xxx are TField's methods that transtype internally. In TField.As_xxx, xxx means, indicates the type of data we provide (when it is an assignment, i.e. aField.As_xxx:= x;). So, the field knows, then, if it should transtype x before its effective storage (in accordance with its true type). And for the opposite, it's simply asking the TField to transtype its internal type towards an external typed variable. So yes: when asking for the value with AsInteger (your question), the TFloatField should round its native real value towards the nearest integer. Very Helpful thank you So i could use ?:  FieldByName('IntegerField').AsFloat --> Return : Float (BSp: 2.0) FieldByName('IntegerField').AsString--> Return : Float (BSp: '2') FieldByName('IntegerField').AsInteger--> Return : Float (BSp: 2) or FieldByName('IntegerField').asInteger := IntValue --> In DB Filed would be: 2 FieldByName('IntegerField').AsString := StrValue --> In DB Filed would be: 2 FieldByName('IntegerField').AsFloat := FloatValue --> In DB Filed would be: 2 ---------------------------------------------------------------------- devEric69 · 2021-07-21 14:31 Quote from: Weitentaaal on July 21, 2021, 03:08:18 pmSo i could use ?: [snip]  AFAIK, yes: that's what the TField's As_xxx method are for. ---------------------------------------------------------------------- Weitentaaal · 2021-07-22 14:12 Much Thanks