Jump to content


Photo

Floating value in NextDBGrid


  • Please log in to reply
8 replies to this topic

#1 ernschd

ernschd
  • Members
  • 6 posts

Posted 02 September 2014 - 12:29 PM

Hello,

i have a Sqlite-Database containing some integer values, for example 6410. I have to divide by 100, (= 64.10).
My try:

procedure TForm1.NxDBTextColumn1SetCell(Sender: TObject; ACol, ARow: Integer;
CellRect: TRect; CellState: TCellState);
var myText: string;
myValue: Double;
begin
myText := NextDBGrid1.Cells[Acol, Arow];
myValue := StrToInt(myText)/100;
myText := FloatToStr(myValue);
NextDBGrid1.Cells[Acol, Arow] := myText;
end;

But with this i get an exception "64,10 is not an valid integer value for Field..."
What's the right way to do this?

Thank you.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 02 September 2014 - 07:45 PM

Hi,

I think that this is more DB Field issue, but it may be that you have used to assign float value to TIntegerField?

Maybe this have helped you a little bit.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 ernschd

ernschd
  • Members
  • 6 posts

Posted 04 September 2014 - 10:54 AM

I'll try.

But i have a general Question: how can i change the Celltext by runtime? For example, i like to insert the currency in a Field (125 Euro). The Property "TextAfter" seems not to work with an Memo-Field.
Or format the value of an Increment Column (001)?

Thanks.

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 September 2014 - 11:03 PM

Hello

I will fix TextAfter with MemoField, it seems to be a bug.

Beside this, maybe you can look at OnApplyCell for assigning text virtually.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 ernschd

ernschd
  • Members
  • 6 posts

Posted 05 September 2014 - 11:45 AM

Thanks.

Last question (hopefully): is it possible to display only filled cells? It looks strange if there is a very big table containing just two lines for example.

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 07 September 2014 - 01:14 AM

Hi,

Not sure if I understand. Can you please send me screenshot?
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 ernschd

ernschd
  • Members
  • 6 posts

Posted 08 September 2014 - 10:17 AM

Sure. Here they are: the file "Current.png" is made with NextDBGrid, and the file "My Wish.png" looks like i want it.

Attached Files



#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 09 September 2014 - 01:43 PM

Hi,

Please very sorry again :( I am unable to see topic about what need to be done. Maybe because pics are quite bad in quality (much compressed?)

Can you please give me more details again. I am very sorry for asking more.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#9 ernschd

ernschd
  • Members
  • 6 posts

Posted 09 September 2014 - 03:21 PM

I sent you an email.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users