Solved

Data-Aware Checkbox: ValueUnchecked problem

Posted on 1998-03-03
6
604 Views
Last Modified: 2010-04-04
I am using data-aware check boxes, and I want the boxes to be unchecked if the value in the respective field is NULL, ie nothing there, a blank field, no data. As if no data had been entered yet.

I've tried the following and they don't work:

1. DBCheckBox.ValueUnchecked := ''; (no spaces)

2. DBCheckBox.ValueUnchecked := NULL;

3. DBCheckBox.ValueUnchecked := ' '; (1 space)

Can you help me here?
0
Comment
Question by:jsweby
  • 3
  • 3
6 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360039
Hi jsweby,

You have to use IsNull

eg. Table1.FieldByName('CheckThis').IsNull

Returns true if field content is empty, otherwise false.
0
 
LVL 4

Author Comment

by:jsweby
ID: 1360040
The ValueChecked and ValueUnchecked properties of DBCheckBox cannot take Boolean values, so how do you suggest I implement your answer? The value on the right-hand side of the property ValueUnchecked has to be of type String, as in my original question above.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360041
Wow, don't eat my heart out!

What about ....ValueUnchecked := #0

Besides my first answer can be used if nothing else helps or nothing else is possible :

e.g. DBCheckBox.Checked := (Table1.FieldByName('CheckThis').IsNull = False);


Q : What type is the underlying data?

I just want to help, you know.

Regards, Zif.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Author Comment

by:jsweby
ID: 1360042
Hi ZifNab,

Sorry if you got the impression I was having a go at you, I wasn't!

I've just realised that this component DOES have a Checked value which can be set to True or False. I thought it didn't, which I thought was strange seeing as the standard CheckBox component does. That's why I've been trying to get this ValueUnchecked to work, which only takes a String and not a Boolean value.

Thanks for trying to help, sorry you took my comments the wrong way!
0
 
LVL 4

Author Comment

by:jsweby
ID: 1360043
Zif,

If you submit your answer again, I'll give you the points. I can't see how to do it from a comment
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1360044
Hi jsweby,

Sorry about my last comment, had a bad day and couldn't take much at that time ...

What about ....ValueUnchecked := #0

or DBCheckBox.Checked := (Table1.FieldByName('CheckThis').IsNull = False);

Regards, Zif.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now