Starting Transaction Group Causes Nulls to be inserted

I have a transaction group that does not have a trigger. I just want the data to be written to a database table every 5 seconds. when i start the group a row or two will be written to the table with null values. how do i stop the nulls from being written? shouldn’t the values in the OPC tags already be populated before the transaction groups starts firing off?

Thank you,

The group doesn’t wait for data before logging. On time, a long time ago, we had it do that (in FSQL). And then we changed it. I don’t exactly remember why, but I think it was because groups can still do important things even when the data isn’t present (coupled with the fact that there are other ways to handle it). Although, since this does come up from time to time, I guess it would make sense to make it an option.

You have a few options for what to do:

  1. Put a not null constraint on one of the columns in the db, which will cause the group to error out the first time, but will prevent the null data. On the down side, the record will get quarantined in the store and forward system, and will build up over time (but, how often are you really starting and stopping).
  2. Create a trigger condition for the group based on the quality of one of the items. Make a run always expression item with an expression of “if(toInt({TagPath.Quality})=192,1,0)” and then trigger the group on that, when >0. This is the better option, if you don’t already have a trigger on the group.

Finally, you could of course just run a query periodically to delete rows with null values.