StrataFrame Forum

Implementing a scrollable cursor via the maintenance toolstrip

http://forum.strataframe.net/Topic887.aspx

By JKelly - 4/21/2006

Hello,

 

I am working with your sample application (CustomerMaintenance.vb), looking at the mechanics of the customer maintenance form.

 

My question is how does one harness the record navigation events in the maintenance toolbar?

 

Psuedocode for problem case (boCustomer1 = boCustomer)

 

1.) User browses (customer maintenance form), returns to main form which fills with top 1000 records

2.) User navigates, gets to end of recordset (boCustomer1), stops.

3.) Arbitrarily, last name of record stopped at is “Erickson”, customer_id = 1000

 

Unless the user browses again and (somehow) enters a PK of 1000 then the user is ‘stuck’ with no real way to get to record # 1001.

 

What I am looking to do is as follows

 

1.)User navigates through datatable (boCustomer1)

2.)If record_num = MAX(record_num) then

a.    BoCustomer1.Save (commit any unsaved changes)

b.    New boCustomer As boCustomer2

c.    boCustomer2.FillbyPrimarykey (500) (previous and next 500)

d.    BoCustomer1.ClearAndFillFromCompleteTable (BoCustomer2, BusinessCloneDataType.ClearAndFillFromCompleteTable)

e.    (Event – reset (enable) navigation buttons)

f.    BoCustomer2.dispose, BoCustomer2 = Nothing

 

Obviously the #’s could be 10, 100, 1000 and so on. I am trying to create a seamless experience without holding the entire 19K+ table in memory, essentially implementing something similar to a scrollable cursor that is not tightly bound.

 

I could use my own record navigation controls to implement this but I/we like the look and feel of the Strataframe maintenance toolstrip.

 

Any thoughts on harnessing the record navigation events in the maintenance toolbar? I’ve been working through the object browser trying to find the right collection to iterate through so I can then access the controls and their events but I am just not getting it.

 

Thoughts/Suggestions on Scrollable Recordsets?

 

Thanks for your time – J

 

By Trent L. Taylor - 4/23/2006

There has been a little confusion on our sample of FillTop100() which I assume is where some of this question began.  We use that sample just to get a small data set from the server to work with when we are showing interaction with our business objects and forms.

If you want to implement the "first 100 / next 100" type of functionality, you will have to code it yourself.  SQL Server does not know what the "next" 100 records would be unless we have a condition of some sort.

The best way to allow an end-user to work with a dynamic data set is through the BrowseDialog.  It allows the users to search for specific records within the entire database and bring just that "narrow" record set back to work on.

If you want to implement a "next 100" type of functionality, then you would need to create a variable within the BO that knows where you are in your search and dynamically create your query.  This would most likely change for each table since the criteria for the "next batch" will most likley change.

There is no reason that you couldn't use the MaintenanceFormToolstrip.  From what I gather in your description, you would want to place your code in the Navigated event of the business object you wish to get the "next 100" records on.  When the navigated event arguments indicate that you are at the end of the table, you could requery the database for the next group.  When this happens, the maintenance form toolstrip will automatically update the buttons for proper interaction.

Private Sub CustomersBO1_Navigated(ByVal e As MicroFour.StrataFrame.Business.NavigatedEventArgs) Handles CustomersBO1.Navigated
      If e.NavigatedPosition = MicroFour.StrataFrame.Business.BusinessNavigatedPosition.Last Then
          '-- Get the next 100 records
      End If
End Sub

Let me know if this helps.

By JKelly - 4/24/2006

Thank you Trent,

Looks like I was looking to trap the wrong event, the act of navigating versus the object having been navigated. I will give it a try.

Thanks for your time - J

By Trent L. Taylor - 4/24/2006

No problem.  Let me know if you have any other questions.