Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Testing if a blob field is null

edited January 2009 in General
Delphi7 and RB 10.07 build 2

Sorry if I've posted this to the wrong group.

In the Report designer (under the Calc tab), I can see the available fields
shown on the Data tab on the bottom right of the screen. What I want to do
is show a message on my report depending on whether a blob field (Graphic)
is empty or not. This field can hold a users picture and I have a customer
who wants to run a "users" report and highlight the users that don't have a
users picture. What I have done is added a Variable to my report and on the
Calc page I placed the following code in the "OnCalc" event:

procedure Variable1OnCalc(var Value: Variant);
begin
if Cards['Picture']= nil then
begin
Value := 'No Picture !';
end
else
begin
Value := 'Has a picture';
end ;
end;

Unfortunately I always get the "Has a picture" which means Cards['Picture']
is never nil. This isn't the case as In my test database I have two users,
one has a picture and the other doesn't. My question is, am I using the
"Cards['Picture']" property correctly. Am I using the correct event etc. I
had this working about 6 months ago but lost the report due to a virus. So
far I've been unable to reproduce it.

Ian

Comments

  • edited January 2009
    Hi Ian,

    ----------------------------------------------
    Tech Tip: RAP: Checking for Null Data Values
    ----------------------------------------------

    The DataPipeline.FieldObjects[] array property provides access to the
    TppField objects. TppField has an IsNull boolean property.

    The notation is DataPipeline.FieldObjects['FieldName'].IsNull

    example:

    if Customer.FieldObjects['Addr1'].IsNull then
    ShowMessage('field value is null');


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2009
    Thanks Nico, that worked fine. I'll now make a backup of this report so I
    don't have to go through this again. :)

    Ian

This discussion has been closed.