Focal Point
[CLOSED]Bit Data Type Error

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6447076186

April 06, 2016, 06:32 PM
wfuser16
[CLOSED]Bit Data Type Error
I have a report that includes a bit data type field from a SQL Server 2012 database whose values are either 0 or 1. For some reason the 1 values are read as -1.

I'm able to suppress the minus sign, but that only changes how the field is displayed. Any values of 1 are still read as -1.

The following is the default description of the field in the masterfile:

 FIELDNAME=ISPRIMARY, ALIAS=IsPrimary, USAGE=I11, ACTUAL=I4, FIELDTYPE=R, $ 


The documentation (Describing Data With WebFOCUS Language 8.08) says that binary integers may be specified as one of the following: I1, I2, I4, I8. It also notes the USAGE must be either P or D. I've tried both with no luck.

Also, I'm not sure why the documentation specifies that for ACTUAL to USAGE conversions ACTUAL integer is only automatically converted to either USAGE integer or date when it also says to set the USAGE for binary integers to either P or D.

This message has been edited. Last edited by: <Emily McAllister>,


Release 8.08
Windows Server 2008
Excel, HTML
April 06, 2016, 06:43 PM
Waz
If its not working correctly, you may have to open a case with Techsupport


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 07, 2016, 07:45 AM
Mike in DeLand
I've got the same thing going on here. I would be most interested in hearing how this plays out. For now, when I need to test the field, I test for NE 0 instead of EQ 1 or EQ -1.


Webfocus 8
Windows, Linux
April 07, 2016, 08:46 AM
Chad Miller
I have also noticed this same error. After looking at the masterfile and seeing to error, I just decided to check for -1 instead of 1. I would also be interested in the outcome if you open a case.


WebFOCUS 8105
Windows, All Outputs
April 07, 2016, 05:46 PM
Waz
What would happen if you tested for ABS(field) EQ 1 ?

Does it translate to SQL ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 08, 2016, 03:34 AM
Tony A
What about trying the BITVAL function?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
April 08, 2016, 08:40 AM
stur0063
Here's my solution to the BIT issue.

We have a SQL Server table with a BIT field for ACTIVE employees.

We do a little define action:

DEFINE FILE H2O_GENSUITEPARSEEMPLOYEES ADD
BIT_VALUE/I1 = IF ACTIVE EQ -1 THEN 1 ELSE ACTIVE;
END

Then I use that in my WHERE statement:

WHERE BIT_VALUE EQ 1;


webFOCUS 8207.15
WindowsServer 2019
April 08, 2016, 08:42 AM
stur0063
quote:

What would happen if you tested for ABS(field) EQ 1 ?


This sounds clever - I don't think I would have ever thought of this way.


webFOCUS 8207.15
WindowsServer 2019
April 08, 2016, 12:25 PM
GavinL
I use stored procs for all SQL access and usually cast my bits to int, before returning to WF.

select cast(mybit as int) 'mybit'
, second_col
.....



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
April 18, 2016, 02:20 PM
wfuser16
Thank you everyone for the suggestions. I've used some of these workarounds in the past, so that wasn't the issue. I was just trying to figure out why this problem was occurring in the first place.

I'll try to open a case since it seems like I'm not the only one who has seen this. I think for the time being, I'll use defines in the master file itself so the data appears as it is in the database.


Release 8.08
Windows Server 2008
Excel, HTML