When I copy my "Search" BO used in the BrowseDialog to my "Real" BO used on the form


When I copy my "Search" BO used in the BrowseDialog to my "Real" BO...
Author
Message
Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
This code doesn't work becasue boProspectSearch.client_pk contains the PK of the first record even though I selected the 5th record in the grid. I know I should be able to do this because when I don't copy the data from the "Search" BO the form populated correctly with the selected record. So what do I need to do here?

Thanks!

private void brwProspects_BrowseDialogClosed(MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogClosedEventArgs e)

{

// Copy the data from the prospect search business object

// to the clients business object

string[] lcFieldList = new string[] { "client_pk", "type_fk", "tier_fk", "company_nme", "company_ein", "stradd_nme", "stradd_sfx", "city_nme", "state_nme", "pcode_nme", "active_flg", "sales_fk", "relat_fk", "admin_fk", "analy_fk", "file_dir", "csz_dsc", "lastmod_nme", "lastmod_dte" };

Int32 lnClient_pk;

if (!boProspectSearch.IsEmpty)

{

lnClient_pk = boProspectSearch.client_pk;

boClients.CopyDataFrom(boProspectSearch.CurrentDataTable.DefaultView.ToTable(true, lcFieldList), MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable);

boClients.NavigateToPrimaryKey(lnClient_pk);

}

}

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You are welcome to produce a sample the replicates your behavior and post it here, but if you look at the ShowDialog method in the SF source code in the BrowseDialog class, you will see that the BrowseDialogClosed event isn't called until the index has been set, so there may be another factor here in your code.  Also, we use a technique similar to this (for other purposes) in our medical software, so I am confident that it will work, but there just may be something else in the mix here.  Here is the code that I an referring to:

(I have also attacherd this image so you don't have to squint BigGrin)

  1. The dialog is shown and the results captured
  2. The CurrentRowIndex is set within the BusinessObjectToPopulate (_BusinessObject)
  3. The BrowseDialogClosed event is raised

So you can see that the CurrentRowIndex should be set at this point, so as I mentioned, there could be something else going on here that I cannot see in your snippet.  A code sample always helps when trying to work through problems like this.  Let me know if this doesn't get you going in the right direction.

Attachments
BrowseDialog.png (144 views, 35.00 KB)
Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Trent L. Taylor (10/28/2008)
  1. The dialog is shown and the results captured
  2. The CurrentRowIndex is set within the BusinessObjectToPopulate (_BusinessObject)
  3. The BrowseDialogClosed event is raised

So you can see that the CurrentRowIndex should be set at this point, so as I mentioned, there could be something else going on here that I cannot see in your snippet.  A code sample always helps when trying to work through problems like this.  Let me know if this doesn't get you going in the right direction.

 

OK - I think I know what is happening here. boProspectSearch is based on a ciew so no primary key is specified in the BP mapper. Therefore, loForm.SelectedPrimary key is Nothing Tongue.

Is there a way to tell the BO mapper that a field in the view is a primary key?

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yup, go into the BO Mapper, right-click the BO in question, the open the Advanced Options.  You can override the Primary Key.  This was actually implemented for this very purpose (when mapping to views).  It has other uses as well, but this is what spawned this feature.


Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Trent L. Taylor (10/28/2008)
Yup, go into the BO Mapper, right-click the BO in question, the open the Advanced Options.  You can override the Primary Key.  This was actually implemented for this very purpose (when mapping to views).  It has other uses as well, but this is what spawned this feature.

Thanks a million, Trent! You are my hero!

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
LOL...glad you found what you needed Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Marcia G Akins - 17 Years Ago
Ivan George Borges - 17 Years Ago
Marcia G Akins - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Marcia G Akins - 17 Years Ago
                         You are welcome to produce a sample the replicates your behavior and...
Trent L. Taylor - 17 Years Ago
                             [quote][b]Trent L. Taylor (10/28/2008)[/b][hr] The dialog is shown...
Marcia G Akins - 17 Years Ago
                                 Yup, go into the BO Mapper, right-click the BO in question, the open...
Trent L. Taylor - 17 Years Ago
                                     [quote][b]Trent L. Taylor (10/28/2008)[/b][hr]Yup, go into the BO...
Marcia G Akins - 17 Years Ago
                                         LOL...glad you found what you needed :)
Trent L. Taylor - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search