Why are these fields deemed to be empty?


Author
Message
Peter Jones
Peter Jones
Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

Please see attached screen shot. This is a DevExpress grid populated from a stored proc. All the fields from the left, up until the column with 999, are "required fields" in the BO. The ones to the right of the 999 are not. The bottom panel shows the data that is returned by the stored proc.

I changed the value in the 4th column from 100 to 3100 and clicked Save. This fired a Broken Rule on the 5 marked columns saying they are 'required'. From the database listing you can see the checkboxes with errors have a value of False (0) and the column second from the right (which is an integer column) also has a value of 0.

If I change the integer column from 0 to 1 the broken rule goes away for that column. If I then change the column back to its original value of 0 the broken rule still doesn't fire. However, the same process does not work for the checkboxes, i.e. ticking a checkbox to True stops the broken rule from firing but once it is ticked back to False the rule fires again.

Cheers, Peter

Attachments
SF12.JPG (128 views, 274.00 KB)
Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, the required fields validation tests on the "default" value for each data type... the value that the columns are initialized to if the AllowNullValuesOnNewRow = False.  So, if you want to test on NULL values, then you'll need test on those values yourself rather than use the built-in required fields options.
Peter Jones
Peter Jones
Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Ben,

Sorry, you have lost me... The row in question isn't a new row, it is the first row in the database (refer to the table in the screen shot I sent) and every column has a value - it just seems to be False columns and zero columns that are creating the problem.

A more general question relating to your answer. The BO in question does have "AllowNullValuesOnNewRow = False" which is what I want, i.e. I want to be in control of setting defaults which I do as follows:

Private Sub boATT_SetDefaultValues1() Handles Me.SetDefaultValues

Me.ATTActive = True

Me.ATTDType = "1"

Me.ATTFBatch = False

Me.ATTFHide = False

Me.ATTID = Guid.NewGuid()

Me.ATTLookUp = False

Me.ATTMandInLU = False

Me.ATTRangeFrom = 0

Me.ATTRangeTo = 999

Me.ATTRBatch = False

Me.ATTSBatch = False

Me.ATTSequ = 0

Me.ATTSHide = True

Me.ATTSPBatch = False

Me.ATTType = "1"

End Sub

When I create a new row the above code fires and the correct default values are set - I can see them in the UI. However, when I click Save I have the same problem I get with an existing row, i.e. any fields set to False or Zero fires the Required Fields broken rule.

Cheers, Peter


Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Whether the row is new or not, required fields assume that False and 0 are empty.  You can build the source code in debug mode to see how required fields are validated.  But the reason they are giving you the error is because they are set to false for the booleans and 0 for the integers.  Generally boolean values are not good candidates for the required fields collection since there are only two values.  If you are using NULL support, this value gets translated into a False in most cases.

I recommend removing these fields from the Required Fields collection and just adding your own business logic in the CheckRulesOnCurrentRow event.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search