Browse Dialogue Problem


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Ben.

On both my test BO and the actual application I'm coding the AllowNullValueOnNewRow on the BO is set to False. If it helps, when receiving this error the BO's set-default-values code never gets executed. It fails right after retrieving the BO's FieldDbTypes.

-Larry

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
Check the "AllowNullValues" property on the business object and make sure it's False.  If that property is set to True, then the business object will not initialize the values within a new row.
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Ben,

Correct me if I'm wrong but I was under the impression that the OM alternate values for null was to eliminate problems where NULL data was returned from the database. In this case I'm adding a new row. Since I don't have the source for 1.41 I'm not able to step through all of the code but what I've noticed is that in the cases where I'm receiving the errors is that fileds that would automatically be set to a non null value (even if they were not configured to do so in OM) for a new row are not being set.

-Larry

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
Oh, the infamous DBNull.Value...  basically, you're getting that during the Get of your property (just like your screenshot says).  The DBNull is a special object type that is used to represent a NULL value in the database.  If a field can contain null values, then you'll need to configure that field through the BOMapper to either "Return Alternate On Null" or "Use Nullable Generic" (the generic can only be used with value types (no strings)).  Your best bet would be to either return "Nothing" or "String.Empty" on a null value.  That will fix your problem. 
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

Ben,

 

Thanks for the explanation of the warning message. I’ve attached a couple of screen shots. The two field sample I’m using is a stripped down sample of a more complex object. While that form includes an enum bound combo box it was a string property that was getting the same error.  In stepping through the code I noticed that when “New” was clicked without first doing a browse, any fields that were not set to allow null in OM were automatically set to default non-NULL values. When a Browse was done and rows retrieved prior to clicking on “New’ the fields in the BO were not automatically set to defaults.

 

-Larry

Attachments
OM.png (172 views, 66.00 KB)
ErrorMsg.png (177 views, 110.00 KB)
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
The warning means that you have one or more fields that have been customized on the business object that have been "removed" from the business object meaning this:

1) MyBO's SQL table has a field called "field1"

2) You customize "field1" to, say, trim the value.

3) You change the structure of the SQL table so that "field1" no longer exists (or was renamed).

4) The BOMapper thinks the field disappeared, but the customization record still exists within the BOMapper.

So, the warning is just telling you that not all of the fields that you customized are being created on the business object.

As for your other error, can you post the red error message that contains the stack trace... might tell us where that exception is being thrown from Smile

Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
The field has been customized to the enumeration type in object mapper. I think something else is going on. Also attached is a screen shot from OM that I get when I do a "Rebuild All" after customizing one BO. What does the warning mean?

-Larry

Attachments
MapperWarning.png (162 views, 78.00 KB)
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
You get the InvalidCastException when the combo box is populated using an enumeration and the bound field property on the business object is not typed as the same enumeration. 

When you use an enumeration to populate a combobox, the SelectedValue (which is what the combobox will bind to by default) actually contains enumeration values, not integer values.  So, to bind to that combobox, you'll need to go to the BOMapper and customize the field to return the enumeration value rather than an integer. 

If you don't want to customize the field, you'll have to populate the combo manually, or it will continue to throw the InvalidCastException Sad

Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

I having a similar problem; getting an InvalidCastException using version 1.41. I have a standard SF maint. form. On the form I have two controls, a textbox and combo box. The combo box is populated by an enumeration and is bound to the BO. The text box is bound to a string property on the BO. If I open the maintenance form and click on “New” I can add a new record with no error. However if I click on browse, retrieve some records and then click “New” I get the InvalidCastException. If I unbind the combo box from the BO everything works fine.

-Larry

 

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, I just fixed that problem... it will be corrected in the next update.

As for the problem of the controls not refreshing when the business object is navigated, if you can reproduce it, let me know, and ZIP your solution and post it here on the forum.

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