StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


123»»»

Order records in a maintenance formExpand / Collapse
Author
Message
Posted 07/30/2008 3:36:44 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 8:24:55 PM
Posts: 90, Visits: 157
Hi

I have a curious situation. I have a table for families, the BO has this method:

Public Sub FillAllRecords()

Me.FillDataTable("SELECT * FROM Familias ORDER BY Apellidos")

End Sub

I add three records, one begin with H, second with D and las one with A. Every time I load the maintenance form, goes to the second record in this case the one beginning with D, the order is correct, the first record is the one with A but I can not understand why goes to the second one.

Regards

Everything is possible, just keep trying...

Post #18212
Posted 07/30/2008 9:08:08 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 6:26:12 PM
Posts: 4,901, Visits: 4,887
You can actually find your answer to this throughout the forum....it becomes a common post.  You have a sort or filter set on your BO which changes the order of the internal data table, but the CurrentRowIndex is left the same.  So when you add a new record or modify a column that is part of the sort or filter, you will either need to clear the sort or filter or take this into account.  This is a very common thing that we see out here on the forum, but I am 99.99% confident that you have a filter or sort applied to he BO or something along those lines that is changing the order of the records in the BO.
Post #18218
Posted 07/30/2008 1:27:51 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 8:24:55 PM
Posts: 90, Visits: 157
Hi Trent

Sorry but I dont' have any sort or filter in the form. As I show before the SELECT statement has a ORDER BY and yes the order is respected when the form loads, the only thing is that the record that shows when the form is opened is the second one and the first one.

I review the forums yes but at least the ones I tale a look was on how to use a SORT or how to after save show the records sorted again.

I will review again, maybe as you said is the CurrentIndex... that goes to the second record and I don't know why?

regards

Everything is possible, just keep trying...

Post #18230
Posted 07/30/2008 5:32:34 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 6:26:12 PM
Posts: 4,901, Visits: 4,887
I promise that this is your problem.  If you put a break point you will see that the data behind the CurrentRowIndex is changed....the ONLY way that this will happen is through a filter or a sort or manually changing the data table and/or view.  You are welcome to post a sample, but I have seen this too many times in the past and I am confident that is your issue.
Post #18234
Posted 08/04/2008 11:37:11 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 8:24:55 PM
Posts: 90, Visits: 157
Hi

Just found the solution:

Private Sub FamiliasBO1_ParentFormLoading() Handles FamiliasBO1.ParentFormLoading
'-- Load BO
Me.FamiliasBO1.FillTodos()

'-- Go to first record
FamiliasBO1.Navigate(MicroFour.StrataFrame.Business.BusinessNavigationDirection.First)
End Sub

As the FillTodos is already sorted, I only need to go to the first record. Without that the BO loads ordered but shows the first record in the primary index. Navigate to the first record puts the form just as I need.

Thanks all for your help.

Everything is possible, just keep trying...
Post #18328
Posted 08/05/2008 7:08:12 AM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 4:05:52 PM
Posts: 760, Visits: 3,282
Hi Juan Carlos,

Try putting the Navigate() command in the BO.FillTodos(), that way you keep the code related to the BO in the BO in case you need to call BO.FillTodos() from another place and want to have the records properly sorted.

 
Post #18330
Posted 08/21/2008 1:59:42 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 11/14/2008 8:43:21 PM
Posts: 95, Visits: 403
This is a re-producible issue that I showed Ben on the last day of training in Amarillo using sample app business objects and he confirmed it definitely was not a filter/sort issue with what I showed him, but immediately after the filldatatable, the currentrowindex was set to the 2nd record (or actually a 1 vs. a 0). Sure, putting a navigate in the fill method should rectify the issue, but still curious as to what's actually causing this to happen. I had been meaning to follow-up with Ben but been real busy with some other projects and just getting back to some Strataframe work myself. This has bitten us a few times but we've managed to just work around it for now.
Post #18653
Posted 08/21/2008 2:23:55 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 11/14/2008 8:43:21 PM
Posts: 95, Visits: 403
Actually, a movefirst is what we want instead of navigate, I believe. Navigate tries to update bound controls so don't think that's needed if doing this inside the fill itself.
Post #18654
Posted 08/22/2008 10:02:10 AM
StrataFrame Team Member

StrataFrame Team Member

Group: StrataFrame Users
Last Login: 12/23/2008 11:10:40 AM
Posts: 232, Visits: 511
Trent was looking at the code behind this the other day, and the CurrentIndex is indeed getting set right after the filldatatable, so I'm not sure how that could be an issue. 

However, if it is reproducable, could you post that sample up as an attatchment so we can take a look at it. Ben didn't mention anything to me about it, so he may have already addressed this (