StrataFrame Forum

BO Mapper Bug on FieldChanging event when allow null

http://forum.strataframe.net/Topic33379.aspx

By Larry Caylor - 9/6/2016

I've come across a bug in BO Mapper when adding a FieldChanging event to a field that allows nulls. 
The following code was generated by the mapper. The "If value..." comparison always results to false,
since the value was set equal to the e.FieldValue in the prior line, resulting in the item always
being set to DBNull.
Set(ByVal value As System.Int32)
   Dim e As New TestBOFieldChangingEventArgs(TestBOFieldNames.ta_tst_idvalue)
   Me.OnFieldPropertyChanging(Mee)
   value = CType(e.FieldValue, System.Int32)
   If value <> CType(e.FieldValue, System.Int32Then <---- Always False
        Me.CurrentRow.Item("ta_tst_id") = value
   Else
       Me.CurrentRow.Item("ta_tst_id") = DBNull.Value
   End IfEnd Set
Since I've configured the item to be Return Alternate on Null / Set Null on Alternate to 0 
I believe the if statement should be "If value <> 0 Then" as it does when adding a FieldChanged event.
The following code was generated by the mapper for a field where Alternate on null was set to 0 with
both FieldChanged and FieldChanging events. The FieldChanged event code uses "If value <> 0" while the
FieldChanging event code is using "If value <> Ctyp..."
Set(ByVal value As System.Int32)
   Dim e As New TestBOFieldChangingEventArgs(TestBOFieldNames.ta_tst_idvalue)
   Dim llRaiseEvent As Boolean = False
   Dim loRow As DataRow = Me.CurrentRow
   Me.OnFieldPropertyChanging(Mee)
       value = CType(e.FieldValue, System.Int32)
       If value <> 0 Then
           If Not loRow.Item("ta_tst_id").Equals(valueThen llRaiseEvent = True
       Else
           If Not loRow.Item("ta_tst_id").Equals(DBNull.ValueThen llRaiseEvent = True
       End If
       If value <> CType(e.FieldValue, System.Int32Then
           loRow.Item("ta_tst_id") = value
       Else
          loRow.Item("ta_tst_id") = DBNull.Value
       End If
       If llRaiseEvent Then Me.OnFieldPropertyChanged(MeNew TestBOFieldChangedEventArgs(TestBOFieldNames.ta_tst_id))
End Set



By StrataFrame Team - 9/6/2016

Hrm.  Good catch, Larry.  I'll get that fixed for you.
By Edhy Rijo - 9/6/2016

Hi Ben,

Ben Chase (9/6/2016)
Hrm.  Good catch, Larry.  I'll get that fixed for you.

And for me too! Please Smile

Thanks Larry!!
By Keith Chisarik - 9/9/2016

Good to see a developer post. Hi Ben.
By Larry Caylor - 10/4/2016

Ben,

How are you doing on that fix?

-Larry
By Larry Caylor - 10/14/2016

Any estimate on when a fix will be available for this? It's a pain to have to work around it with custom code.

-Larry
By Larry Caylor - 11/2/2016

PING!  I'd really like to have a fix for this as it is causing problems for me.

-Larry
By Larry Caylor - 11/4/2016

Is anyone from MicroFour monitoring the support forum??? It's been two months and this issue still exists. I wouldn't think it is that difficult of a fix to make.

-Larry
By Larry Caylor - 1/17/2017

Any chance this will get fixed?  It's a pain to have to maintain custom code as a work around.

-Larry
By StrataFrame Team - 1/18/2017

Howdy Larry,

I got this fixed.  I am currently unable to do a full build because our build server is in a state of flux, but I have updated the posted release with the VISX to include this fix.  The change was made to the AddIns DLL, so that should be the only one you need to swap out.

By Larry Caylor - 1/19/2017

Thank youSmile