Enforce field MaxLength in the BOM by default


Author
Message
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
As far as I know there is nothing in SF to automatically enforce the characters entered in a Textbox with respect of the field length value.

An error like this can be easily generated by the end user.

BusinessLayerException
  An error occurred while saving an the data to the server.
DataLayerSavingException
  String or binary data would be truncated.

I know I can create a lot of broken rules to validate the field Length, but I strongly believe that this should be handle by the Business Object Mapper since it has all the information needed to add this kind of validation to the BO designer file.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Just set the MaxLength on the textbox so that no more than what is allowed can be entered.  You wouldn't really want to manage this through the business rules anyway (a very clumsy and dirty way to handle it).  Just set the MaxLength and you will be good.
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (03/21/2008)
Just set the MaxLength on the textbox so that no more than what is allowed can be entered.  You wouldn't really want to manage this through the business rules anyway (a very clumsy and dirty way to handle it).  Just set the MaxLength and you will be good.

Trent,

That is exactly my point, the BOM metadata has the field length information then enforcing this kind of rule should be more practical if done via the BOM in one single step instead of me going through all fields in all my textboxes setting the MaxLength manually and then keep remembering to do it all the time.

This is the kind of rule which is a MUST because if I don't do anything to enforce it, then the database will throw and exception which is not good for the end user.

My request is to add this kind of functionality in the BOM to either enforce this via the textbox MaxLength or to automatically generate a broken rule like this:

''' 

''' Checks the business rules on the current row

'''

Private Sub MyBusinessObject_CheckRulesOnCurrentRow(ByVal e As

MicroFour.StrataFrame.Business.CheckRulesEventArgs) Handles Me.CheckRulesOnCurrentRow

    '-- Make sure the customer's last name length is not greater than 30

    If Me.cust_lname.Length > 30 Then

        Me.AddBrokenRule(MyBusinessObjectFieldNames.cust_lname, "Last name lenght can not be more than 30 characters.")

    End If

End Sub



Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Edhy,

I feel like we keep going around in circles here.  I have already told you, in more than one post, that we will consider adding some of this functionality down the road.  Developers create massive applicatons, everyday, including ourselves, without letting this slow us down.  It is a very simple property to set...this is not a "show-stopping" request.  You are coming from a data-driven environment...VFP.  We too came from VFP and have implemented logic into the framework with many of the good ideas that they had...the request you are making is coming from a data-dictionary environment which using thi same logic would be suicide in a large application in a disconnected data environment.

We WILL at some point add additional functionality that will bring in field lengths.  Though this should never have to be checked at the BO level...though you could do it this way, it is really pointless as you can set the MaxLength on a textbox to prevent this from ever getting to this point instead of the end-user seeing another error or warning.  So this logic is not as simple as you keep bringing up...because this 1.) needs to be optional 2.) impemented at the control level which means any control that supports text entry will need to support this logic, thus making 3rd party controls more complex. 3.) Needs to provide support for all environments versus just our controls, etc. 4.) This will require support for al database types, not just SQL Server and so it will entail checking for VarChar, NVarChar, and support for SQL Server, Oracle, DB2, VFP, Access, OLEDB, etc. 

When developing a framework and trying to appeal to the masses, it is best to make the change so that it will be respected in the broad spectrum.

Finally, if this is such a huge piece of your application, you could implement this logic in less than an hour.  If you want to take the BO approach, then inherit the BusinessLayer and create your own BoBase (which is a good idea anyway) and then add this logic to check for field lengths for your specific data type....though I would still recommend doing this at the control level.

I hope this helps you understand that I have heard you on all of your other posts and help you to understand that you can add this logic yourself very easily since it will not need to support all data types, etc.  We try to listen to all of our customers and meet their needs.  Especially in areas where there is a high-demand request...which though this is not in high-demand, we do see that there could be some things that help speed development up in the long-term.  Thanks for your input and understanding.

Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (03/21/2008)

When developing a framework and trying to appeal to the masses, it is best to make the change so that it will be respected in the broad spectrum.

Trent,

As I said before in this forum, I am new to .NET and do appreciate any kind of input anybody here can do to help me out. Tongue

Please don't get my postings in the wrong way, if I gave you the impression of going in circle in this topic, that was not my intention.

I am in the process of converting VFP projects to VB.NET with SF, while doing this, I am learning the .NET way of doing some things and along this the SF approach to those situations, so my posts are in regard to let you guys know of things I believe may enhance SF in the future, based on my experience working with VFP frameworks, of course that does not necesarily means that I want that feature today, or that it is a valid doable feature.

I hope this helps you understand that I have heard you on all of your other posts and help you to understand that you can add this logic yourself very easily since it will not need to support all data types, etc.  We try to listen to all of our customers and meet their needs.  Especially in areas where there is a high-demand request...which though this is not in high-demand, we do see that there could be some things that help speed development up in the long-term.  Thanks for your input and understanding.

Since you made the suggestion, I am already using the MaxLength property Tongue.  So far, nothing is a show stopper for me Hehe the easy way would be to keep building solutions for my customers with VFP and here I am in the .NET world using the framework I believe is closest to what I am used to, and believe me it took me a while to review other framework vendor and decided to stay and invest in SF, and one of the major reason for my decision is the kind of support provided by you and the other SF team members.

Anyway, thanks for the points!!!Wink

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
No problem, Edhy.  It is 100% our desire to add anything to the framework that will enhance not our our development experience, but every developer that uses SF.  We listen to every suggestion made from every developer and we discuss and determine which of those suggestions need to be implemented into the framework.

I understand exactly what you are going through at the moment, as do many other developers out here on this forum.  It took us a while to "break out of our shell" so to speak and finally smell the roses BigGrin  Many of the things that you are fighting is simply just trying to come from an environment in which you were comfortable and then try to apply those same techniques towards .NET.  Obviously this is met with some frustration and scratching of the head when trying to resolve your problems.

This is why we have really developers and tweaked our training classes over the years...to cover things just like this. 

At any rate, we are truly glad that you chose SF and we do appreciate your suggestions....this is how things get better!

Happy Easter...I am going to take off and spend the rest of the day with my family.  Talk to you soon.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I understand exactly what you are going through at the moment, as do many other developers out here on this forum. It took us a while to "break out of our shell" so to speak and finally smell the roses BigGrin Many of the things that you are fighting is simply just trying to come from an environment in which you were comfortable and then try to apply those same techniques towards .NET. Obviously this is met with some frustration and scratching of the head when trying to resolve your problems.


Can I get an "Ahmen" brothers and sisters! I vote this as the understatement of the year, both on the frustration part and the smelly roses part Wink



This is why we have really developers and tweaked our training classes over the years...to cover things just like this.


If you haven't signed up for the class yet...do it. Best training class I've ever had.



Happy Easter...I am going to take off and spend the rest of the day with my family.


Happy Easter!
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Greg McGuffey (03/21/2008)

If you haven't signed up for the class yet...do it. Best training class I've ever had.


Hi Greg,

I have not signed up yet, but it is on my priority list. 

In my experience with other training and developer conferences, it is best when you are familiarized with the tools, and that is just what I am doing know with this project, getting to know SF.  I belive I'll be in good shape for the July class. Cool 


Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I belive I'll be in good shapefor the July class. Cool




Me too! Smooooth
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
er...Blush...what is meant was that I also believe you'll be in good shape by July...you making great progress!
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