How do I maintain Alpha Order on a Maintenace Form


Author
Message
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I created a new form and dropped a BO on it. Now as soon as I start typing in the Company field exactly the same thing happens as the picture show I get the form filled in???? I don't have a clue. Why does it not happen on the first and last names???? Could it be the SQL back end that is doing it? TIA.
Attachments
newcustomerform.png (88 views, 23.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Terry,

You have something going on with the BO.  Can you send me your project?

Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I certainly can but I am not sure how to do it. Do I zip the solution subdirectory? And what do I do about the SQL database? TIA.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yeah, zip up the solution and all of the sub folders and as for the SQL database, just do a backup and include that in a zip as well then I can restore your backup to my test server.
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Alright here it is. Please let me know if I did it correctly. TIA.
Attachments
lighting.zip (82 views, 1.00 MB)
Lightingdata.zip (87 views, 149.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Ahhhh...yeah, that will get you every time Smile  You have a sort on the CustomersEditBO set to "cust_lastname, cust_firstname" ....so, when you create a new record, modify the name fields, etc. the record pointer is moving on you.  First, in this instance, I would order the records when they are retrieved with an ORDER BY command.  If you want to use the sort this way, you have to take it into account so when you create a new record, or are modifying a record, you need to remove the sort and then add it back once the editing is complete...that should get you going though. Smile
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Can you maybe explain a bit more why the sort is making the record pointer move when I add a record? I think I tried putting the the order by clause in the Select but when I added a record then the records were no longer in alpha order by name. After a record is added or edited how do you repopulate the BO so that the maintenance form will show them in Alpha order? First thanks for all of your attention and help. I am glad you found out what was wrong but for some reason I don't have my mind around how it works yet. Again Thank You.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Sure, it is actually quite simple.  As you may have already learned, the BO has several exposed properties within the BO: CurrentDataTable, CurrentView, CUrrentRow, and CurrentRowIndex.  All of the BOs logic surrounds the CurrentView which is a DataView (CurentDataTable.DefaultView is the same reference).  The sort on a DataView is dynamic, so as soon as you add a new record (or modify a field within the sort), the view will "reshuffle" to match the updated values.

Example:

DataView Indexcust_FirstNamecust_LastName
0JoeSmith
1TrentTaylor

If I add a new record  and have a sort of (cust_LastName, cust_FirstName), the instant that the new row is added to the DataTable (which in turn is added to the view), the sort is effective and resorts the list:

DataView Indexcust_FirstNamecust_LastName
0(empty)(empty)
1JoeSmith
2TrentTaylor

However, the CurrentRowIndex of the BO is still set to 0 since the BO has not actually navigated....so if you were to call a BO.Refresh() all of the fields would reflect the newly added record...but instead, you are only seeing changes to the fields that are changing which made it look like it was updating two records at once.

The Sort is a great feature and we use it often, but when you use Sort and Filter, you need to take into account new and modified records otherwise you will have strange behavior...I have chansed my tail more than once for this reason.

Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
OK the mud is starting to thin a bit. The BO is Dynamic and since the sort is on cust_lastname and cust_firstname it makes sense that as soon as those are added then the BO reshuffles and the form is filled with other data. According to what you have said it seems I have the following options.

If I use the Sort event:

It sounds like I could turn the sort off when adding and editing and as soon as they are over turn it back on. At that time I guess I would refresh the BO. I understand this concept but I do not understand how\where I would do these. I am sure I would turn it off beforesave and beforeedit if these events exists I will look and see and probably turn it on in aftersave.

If I don't use the Sort but use the Order by in the Select:

I would some way have to refresh the BO after saving the new record or saving the edit. Again where/how?

I will start looking at events of the BO and see what a come up.

Again Thanks you so much.

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

It sounds like I could turn the sort off when adding and editing and as soon as they are over turn it back on. At that time I guess I would refresh the BO. I understand this concept but I do not understand how\where I would do these. I am sure I would turn it off beforesave and beforeedit if these events exists I will look and see and probably turn it on in aftersave.

Yes, but you will constantly be fighting this...my recommendation would be to use the ORDER BY within the query in this particular scenario.  Where you place this depends on what you are trying to accomplish, but BeforeAddNew would be one place to turn it off and AfterSave you could turn it back on.

I would some way have to refresh the BO after saving the new record or saving the edit. Again where/how?

In the AfterSave event you could resort the BO:

MyBO.Sort = "cust_LastName"
MyBo.CopyDataFrom(MyBo, ClearnAndFillFromDefaultView)
MyBo.SOrt = ""

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