Jump to content


Photo

Cell(NumberCol).IsNull is False for a blank integer value--bug?


  • Please log in to reply
6 replies to this topic

#1 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 04 August 2021 - 01:11 AM

Hi, Boki:

Discovered that Cell(numbercol).IsNull is False for a cell which is blank (the dataset is null for that field), but evaluates to 0 when Cell(NumberCol).asInteger.

 

Please correct this since 0 is a value, but blank/null is not and distinctly different.

 

Thank you,

Chuck



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 August 2021 - 01:29 AM

I’m not sure what I should do in this situation. Maybe throwing access violation is right thing to do?


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 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 04 August 2021 - 01:51 AM

Oh, yeah:

Same thing applies to the DateTime cells: 12/30/1899 is not a null/blank date. For null/blank dates, I would prefer an actual blank in the grid.

Can you fix that or suggest a work around?

Thank you,

Chuck



#4 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 04 August 2021 - 01:58 AM

Per your response:

Not sure an AV helps at all. NULL values are common in datasets, but distinctly different from any other value.

Can't you just display a blank for such instances?

 

With the DateTIme, it is much easier to scan the grid visually looking for a blank than it is to have all cells filled, the difference being a more difficult to see string of numbers.

In a recent project with NextGrid6, I ended up using the Datetime of '00/00/0000' which is an actual TDateTime of  -693594. Maybe that will help with the TDateTime issue?

Thank you,

Chuck



#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 August 2021 - 09:57 AM

Hi Chuck,

 

Maybe for your use case is good to use Empty property of Cell? In that case you can specify EmptyCaption inside Column?


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.

#6 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 04 August 2021 - 12:01 PM

Hi, Boki:

Took up your suggestion re: Empty property of cell. Set Column EmptyCaption = '00/00/0000' (was not sure how to put in blank)

 

following code does not work to replace 12/30/1899 as output:

with gridClientSessions do

begin

 if fieldByName('gnn_update').IsNull then <-- confirmed that this evaluated to NULL for field
        Cell[NxDateGNNUpdate.Index, LastSesRow].Empty := True <-- this was set, but still showed 12/30/1899
        else
    Cell[NxDateGNNUpdate.Index, LastSesRow].AsDateTime := FieldByName('gnn_update').AsDateTime; //GHN Upload date
end;
 
Not sure how your suggestion applies to Number Columns. EmptyValue is 0 by default and cannot replace with blank.
 
Please advise.
Thank you,
Chuck


#7 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 04 August 2021 - 12:15 PM

Tried the following:

 

if fieldByName('gnn_update').IsNull then
        Cell[NxDateGNNUpdate.Index, LastSesRow].Hide
        else
    Cell[NxDateGNNUpdate.Index, LastSesRow].AsDateTime := FieldByName('gnn_update').AsDateTime; //GHN Upload date
 
Have been using Cell.Hide to not show the checkbox of a particular cell and it works great, but here, it makes the entire cell merge with an adjacent cell, making that cell wider and the combined cell have a value and that values is shifted over out of the intended column. The good news is the blank date is now not visible. Am I close? Is it possible to Hide the cell contents, without losing the cell boundaries?
 
Thank you,
Chuck





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users