February 15, 2007, 09:33 AM
gkataSQL Bit
I have a SQL table that has a column with a format of BIT. When I query the column in WebFOCUS the value comes back with a -1 (in sql it comes back as 1). Based on the advise of the IBI site, I used the "ABS" rountine to correct this. Although, with this method I would have to define this all the time. I could add a DEFINE to the master, but does anyone know of a work-around, for the Metadata?
February 15, 2007, 11:13 AM
FrankDutchYou might let this value as is.
The other value is 0 so the meaning will probably be true and false.
February 16, 2007, 09:56 AM
KerryHi gkata,
This is a known issue:
Reading BIT data types from a SQL Server DatabaseTo correct the metadata/synonym, you can create a define field with the ABS subroutine in your master file. Unfortunately, currently the ABS subroutine is the only workaround.
Hope this helps.
Cheers,
Kerry
February 16, 2007, 12:05 PM
susannahI like amsterdam's suggestion
Since the value is a boolean, your fexes will work whether the value is -1 or 1
DEFINE FILE CAR
TEMP/I2 WITH CAR=IF COUNTRY IS 'ENGLAND' THEN -1 ELSE 0;
TESTYES/A3 = IF TEMP THEN 'YES' ELSE ' ';
TESTNO/A3=IF NOT TEMP THEN 'NOT' ELSE ' ';
END
TABLE FILE CAR
PRINT TEMP TESTYES TESTNO
END
...
if this doesn't work for you, and you don't want to use ABS , you could always square the variable ... but amsterdam's answer really makes the most sense, imho.