[Solved] A Boolean is required [closed]


So, if I’m reading your post correctly, you are trying to perform a bitwise comparison against your value ({DataTableCable.ColumnChange}) in the Crystal Reports code.

Looking around online, I can’t seem to see anything that indicates that crystal can perform that kind of comparison. One alternative is to perform that calculation in your .Net code, and store it against a property/column of your datasource object – that way you can simply check if the property is true/false.

Update

Another option, perhaps, is to perform manual arithmetic to calculate this. Nopadol (Link provided by OP) seems to have good examples of how to do this (I’ve reproduced the code below for posterity). The No Stress Tech Guide to Crystal Reports Basic for Visual Studio 2008 (Lesson 9) seems to cover the use of the Formula Editor which should help get you started.

Function Name: ToBin
Function (NumberVar n)
(
    Local StringVar b;
    Local NumberVar d;
    b := "";
    d := n;
    Do
    (
        b := CStr(Truncate(d Mod 2),0) & b;
        d := Truncate(d / 2);
    )
    While (d > 1);
    CStr(Truncate(d),0) & b;
)

Function Name: ToNum
Function (StringVar b)
(
    Local NumberVar lng := length(b);
    Local NumberVar n := 0;
    Local NumberVar i;
    For i := lng To 1 Step -1 Do
    (
        n := n + ((2 ^ (lng – i)) * Truncate(ToNumber(Mid(b,i,1))))
    );
    n;
)

Function Name: BitAnd
Function (NumberVar n1, NumberVar n2)
(
    Local StringVar b1 := ToBin(n1);
    Local StringVar b2 := ToBin(n2);
    Local NumberVar l1 := length(b1);
    Local NumberVar l2 := length(b2);
    Local NumberVar lng := IIF(l1 > l2, l1, l2);
    Local StringVar x;
    Local StringVar y;
    Local StringVar z := "";
    Local NumberVar i;
    For i := lng To 1 Step -1 Do
    (
        x := "0";
        If (l1 >= i) Then
            x := Mid(b1, (l1-i)+1, 1);
        y := "0";
        If (l2 >= i) Then
            y := Mid(b2, (l2-i)+1, 1);
        z := z & IIF(x=y And x="1","1","0");
    );
    ToNum(z);
)

Function Name: BitXOr
Function (NumberVar n1, NumberVar n2)
(
    n1 + n2 – (BitAnd(n1, n2) * 2)
)

Function Name: BitOr
Function (NumberVar n1, NumberVar n2)
(
    n1 + n2 – BitAnd(n1, n2)
)

Example

BitAnd(1, 5)  // = 1
BitXOr(1, 5)  // = 4
BitOr(1, 5)  // = 5

7

solved A Boolean is required [closed]