Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Checkboxes

Status
Not open for further replies.

sk1

Programmer
Oct 10, 2001
44
US
Hi,
I have about 100 boolean fields that I need to place on the Crystal 8.0 report's detail setion with check box checked or blank.
with the label of the columns and check boxes side by side..


I have following code for one of th fields..
//Formula Fields - @CheckBox
if {tblSample.DOBP/F} = 1 then Chr(254) else Chr(168)

this works fine but I need to do this for all of the other fields.. is there an easier way. Do I need to create a separate formula for each one of them?? Please guide me in a write direction

thanks much
 
My initial thought would be that you'd have to create a separate one in every field since the field name is referenced in the formula. But I wonder if there is a way to use a variable instead of the field name and then create a loop to pass it each field name. I don't know though!
 
You didn't give us the complete formula in this

//Formula Fields - @CheckBox
if {tblSample.DOBP/F} = 1 then Chr(254) else Chr(168)

Since the value for "F" is undefined...my bet is that there is a different field for each checkbox..

Having said that....yes, you must create a new checkbox field for each...100 is alot...but it is necessary.

What I do when faced with this problem is create the formulas in 2 steps.

First I create and save the formula names by cloning the first and pasting it into the new formula box, modifying the necessary Eg. change it from Display_Checkbox1 to Display_Checkbox2 , then saving a blank formula

Then composing the formula for Display_Checkbox1 and copying it to clipboard then pasting this formula into the next checkbox formula and changing the difference eg. a different field name.

Then placing each formula on the screen.

It is "donkey labour" takes hours sometimes and is boring...hence the chance for automatic errors propogating through is high....but must be done if what you are doing is what I think....

Jim
 
You could use an array variable and possibly some loop logic, concatenating all 100 checkboxes in one formula. This would make it one field on the report, but because you are checking 100 different fields the formula would have to reference all of them. The headings would have to be separate, and allgning the headings with the boxes in the formula might be the tough part. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Ken

Are you talking about making one field to display 100 checkboxes...??

I'll do the individual 100 formulas everytime...it is boring...but I think I'd beat you for time in a race to complete the task if we started from scratch...And I know individual formulas would be much easier to maintain later.
 
Either way is a lot of work. I am pointing out that it could be done without having to create 100 formulas. In this situation, with 100 different fields and display on details, an array may not help. However, in some situations it is much simpler to maintain the entire array in one formula and display it with another. Options are always good.
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top