Transaction group creating int columns for Boolean data type

I’m having trouble getting a transaction group to correctly use Boolean as the data type for a tag. The basic OPC items and Expression items whose data type is set to Boolean end up getting created in the database as int values instead of bits.

The OPC items themselves are individual bits of a DINT tag. I had expected that I would have to save them to the database as integers and then use a bit-mask to find the bit or bits I wanted from each one, but the OPC Browser allowed me to expand the DINT tag and get to the BOOL for each bit. But when I dragged the bits to the transaction group, they would show up as Int4 for the Data Type. I changed the Data Type to Boolean for each one, but when I enabled the transaction group for the first time, it created the table with all of the Boolean columns as int values instead of bit values. This also happened with an expression item I created which had a data type of Boolean, so I don’t know if it has anything to do with the Int4/Boolean mix-up.

Is this normal for transaction groups to write Booleans as ints instead of bits?

This is with 7.6.4-rc2, running against an MS SQL Sever database. The device in question is an Allen-Bradley CompactLogix.

Hi,

Yes, by default, Ignition maps booleans to int types in the db. This probably isn’t ideal, and should eventually be changed, but that’s how it has been for… forever.

However, you can certainly try changing the mapping to bit, if you want. To do this, log into the gateway, and then go to “Databases>Drivers>Translators”. Edit the translator for the database system you’re using, and modify the “data type mapping” section. After editing, you’ll need to drop and re-create the tables, but you shouldn’t need to restart the gateway or anything like that.

The problems with more specific data types tend to arise on the querying side of things, as sometimes JDBC drivers will bring back the data types as objects that Ignition doesn’t know how to deal with. I doubt that will happen if you simply switch it to “bit”, but after creating the table and logging some data, go into the Ignition query browser in the designer and make sure you can read the table.

Regards,