seek-problem


Author
Message
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

in a form I want to use as a lookup-form I have a problem with the seek-method, which does not seem to work.

On the form, the BO "LieferöookupBO' is filled in the parentformloading-event.

The calling form, which activates the lookup-form, send a search-parameter, which is

assigned to a private form-var. In the Load-Event I tried my seek-implementation:



If cSuche.Length > 0 Then

Dim lRet As Boolean

MsgBox("Count: " & LieferBO1.Count.ToString)  ' Just testing, if the BO is filled. It is.

lRet = LieferLookupBo.Seek(
"adresse='CLA'")   ' Hardcoded just fpr testing purposes.

If lRet Then

MsgBox("Found: " & LieferBO1.ADRESSE) ' Has not moved the current row index, not showing "CLA"

Else

MsgBox("Nothing")

End If



The search happens on a table containing lookup-codes like:

ASAP

AVA

BM

CLA

Now what happens is, that seek returns True, as if if has found "CLA" but the current row index has not changed (as described in the help-file) as the "ADRESSE"-property of the BO is showing the first code in the table "ASAP".

Can anybody tell me. what is going wrong there.

Best regards

Thomas
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
There is something else in your form moving the row back to another position.

Try this.  Instead of doing all of this in a form load.  Override the OnLoad event of the form.  This is safer anyway.  You can still call the base logic, then place your coder after the base code.  At this point, most of the core logic will have been executed.  Another option, is to just create a button on the form, temporarily, that executes your code.  This will prove is something else is moving the row pointer as part of a load-up process.

It seems like there is a navigate going on elsewhere that is positioning the record.  This could happen if you are placing this code to early in the load (prior to core form logic) and there is data binding in place that is binding to the same BO instance that you are working with.

A seek doesn't update the binding where a navigate does.  Also, be sure to check your code to make sure that there isn't something else in your form that accesses the same instance of the BO and moves the record pointer.

Just FYI, the seek is a very straight forward process, so move your code downstream on the loading sequence to see if you can get the results that you are looking for and then you can work backwards from there.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Thomas,

Also, be aware that when you are using a ChildFormDialog, you can take full advantage of the BO Translations, so in your Parent Form, since you know what is your Lookup Code to search for, then do the search in the Parent form and make sure the "LieferöookupBO" CurrentRowIndex is the expected one.

Now back to your original situation, as Trent said, something is moving the record of that BO after the seek, be aware of any BO.Filter or BO.Sort conditions since these will alter the way the BO is navigated and alter the expected result.

Edhy Rijo

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
Thomas:

Be sure to use the BO translations for the child form and use the ChildFormDialog.  This is a MUST really when using child forms as it will save you days of coding since it translates the BOs.  But you MUST...repeat...MUST place you code in the OnLoad (overrride this in the child form) AFTER the base code is called.  All of the translation wiring is in the base class of the load, so if you place your code first, then you could very well have some of the behavior you are talking about.

http://forum.strataframe.net/Uploads/Images/2c47bec8-8a3d-4f86-820c-b1fa.png
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Trent,

thanks a lot for yout help. Executing the code in an Overridden Onload-Event did it, now almost everything works. The only thing I am still struggling with is to find out how to refresh the datagridview with which the BO is connected with a BusinessBindingSource.

The "record-pointer" of the BO is in the right position, which means, the searched row, but the currentrow of the grid is the first row in the BO. How can I synchronize this. I tried the grids refresh-method, but this does not work.

Best regards

Thomas
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Edhy,

thanks for the idea of using a childformdialog, I will have a closer look at it.

Best regards

Thomas
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Thomas,

You are welcome!!!

Thomas Holste (8/16/2012)
The only thing I am still struggling with is to find out how to refresh the datagridview with which the BO is connected with a BusinessBindingSource


I know you are making an effort on this to work, but honestly the best way to handle a child form is using the ChildFormDialog and BO Translations.  About your DataGridView, the BusinessBindingSource should take care of synchronizing the CurrentRowIndex,  I use DevExpress grids, and that is the behavior I see, it could be something different with the DataGridView.

Edhy Rijo

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
The "record-pointer" of the BO is in the right position, which means, the searched row, but the currentrow of the grid is the first row in the BO. How can I synchronize this. I tried the grids refresh-method, but this does not work.


Remember that a Navigate actually refreshes the UI whereas the Seek doesn't.  So you may want to rework your code to try a Navigate and see if that gets you what you wanted.

Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Trent,

thanks a lot. Navigate makes it work like I want it.

Best regards

Thomas
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Edhy,

I wonder if I have understood the conceot of the childformdialog. I use use them when I call forms to edit daa, which is presented on a parent form in some kind of "gridmode". The user selects a record and then edits it.

This lookup-form I am building right now is intended to be callend from many different places, so I thought the easiest and best way is to have it independent from the different forms from which is it called. The data which is used for lookup is not being used on the parent forms so I would have tio setup the BO on each parentform and establish the childformdialog.

Best regards

Thomas
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