Bulletproof Solution : Displaying boolean values as checkbox image.

Hi all,

I want to display a boolean value on my report as checked or uncheked checkbox. Checkbox images are embeded. Couldn't manage the pick up correct image and displaed on the reportview. Any help appreciated.

Flatwhite

[246 byte] By [FlatWhite] at [2008-1-7]
# 1

I have a class list report which has to display a absent field as a checkbox.
All you really have to do is use an expression as follows

= iif( Fields!absent.Value , Chr(254), Chr(168))

AND THEN change the font to wingdings for that particular display field (NOT FOR THE WHOLE REPORT!!!)

I have forgotten the site where i got the solution but they obviously deserve attribution.

nyashaC at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 2

Hi,

I do not know whether you have solved the issue or not.

But here is the way how accomplished the same.

I have to display a tick mark if the boolean flag is true.

So in the table added a image(which is already embedded in the report), and then set the visiblity property to the following expression

Code Snippet

"=iif(Fields!Available_Flag.Value,false,true)"

So if the tick mark will appear in the report if the Structure_Requires_Serving_Office_Flag.Value comes out as true and blank if the value is false.

If you have solved the problem in a different manner, can you share the same so that others can gain some input.........

But even nyashaC's Solution is working fine, just that you can keep the fields size to 15pt so that the image is looking fine....................

KingCobra at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 3

Crystal report does not have any check box control.

What i use to do for this kind of scenario is add two images (i.e Checked and UnChecked state of checkbox)

first on the properties of Checked image there is a button like "x-2" infront of Supress option. Click on that button and write the following code

IF {Field1234}=0 then

false

else

true

do the same with unchecked image

IF {Field1234}=0 then

trie

else

false

ZeeshanUmar at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 4

Thanks for replies. I couldn't come up with a solution anything better than yours. In my case checkbox wasn't a necessity so I used coloured textual representation. I couldn't find a way to mark one of your suggestions as an answer. Sorry.

FlatWhite at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 5

Its nice that your problem has been resolved, i think to mark my question as answer you have to login and then you can see a answer button on my reply or you can click on Was this post helpful ? Yes button. It is better to mark correct answers so that other can also see them to resolve their issues.
ZeeshanUmar at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 6

hi;

how to change boolean values true to 1 and false to 0, for pass the value 1 to my sql db.

itdevgrp at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 7

I am not sure what you are trying to do you can do this by creating a formula as mentioned in my earlier post. Plz write complete scenario so i can give you a better sugession.

ZeeshanUmar at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 8

Hello nyashaC

The solution you offered back on August 1st on MSDN solves most of my problems as well except for one,

I can create the report just fine and this solution is perfect, but then I must export the report via PDF. One fo the reason I wish to use this tool is the ability to export to PDF. It seems as though this font "wingdings" is not supported in the Adobe PDF platform I read a couple of posts below yours and don't really understand how to link to or imbed to an image...

- any ideas to an alternative - or a solution?

Almost there!

Thanks ahead,

Dan Acton

danacton at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 9

Ok, I solved my own problem, but for anyone who needs to export their report to Adobe Acrobat (PDF) - you will want to use the following ASCII characters if you wish to create the report in PDF

Problem: Adobe would not recognize the symbols (Chr(254), Chr(168) in order to assign the Wingdings checkbox font images.

Solution: Use the following ASCII characters in place of: (Chr(82), Chr(84) which translate to the simple "R" and "T" respectively. Then instead of formatting the table cell font to "Wingdings" - use "Wingdings 2" instead.

Now the report will publish in PDF, since all it needs to recognize is the common "R" and "T" values.

So the wonderful solution posted by nyashaC would be as follows:

= iif( Fields!absent.Value , Chr(82), Chr(84)) with a wingdings 2 font

danacton at 2007-10-2 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...

Visual Studio

Site Classified