Getting the ChildFormDialog to Work


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
The following code (C#, sorry VB.NETers) is setup basically like the CRM sample application's Orders and Items:

private Boolean _NewItem;

public SalesOrderDetails(bool pIsNewItem)
{
    InitializeComponent();
    _NewItem = pIsNewItem;
}

private void SalesOrderDetails_Load(object sender, EventArgs e)
{
   
if (_NewItem)
    {
       
this.mSalesOrderDetails.Add();
   
}
   
else
   
{
       
this.mSalesOrderDetails.Edit();
       
this.mPartTemp.FillByPrimaryKey(mSalesOrderDetails.partindex);
       
if (this.mPartTemp.Count > 0)
        {
            ItemNumTextEdit.Text =
this.mPartTemp.partnum;
        }
        RefreshSubtotal(
true);
        RefreshUI(
true);
    }
}

The red highlighted line is where the application error with a BusinessLayerException stating the following:

There are no rows in the current data table.  An edit is not allowed.

The ChildFormDialog is supposed to take care of passing the BOs to the ChildForm, isn't it?  I have the BusinessObjectTranslation setup correctly.  My source is the SalesOrder form's SalesOrderDetail BO (mSalesOrderDetails) and the destination is the SalesOrderDetail form's SalesOrderDetail BO (also called mSalesOrderDetails).

Is there something else that I need to do?  What am I doing wrong?

Thanks,
Bill

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
You need to call Edit after you call the fill method. The error is simply stating that there is no data in the BO, there for it can't do an edit. The check to do any time this might occur is:



myBO.CurrentRowIndex < 0




I use this a lot to validate that there is a current row before I attempt to do something with it.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I really need to read the entire post before I respond.... Blush



I have never use the BrowseDialog or the the ChildDialog, so I'm not going to be much help here (and here I thought I was sooo on top of this one). Looking at the source code, the translated BO appears to be loaded before the Load event would be called, so any semblance of help I might have offered is, well, useless. Pinch



Note to self: Just skip answering posts late on a friday...

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Note to Greg's self:  Make sure you other self doesn't find out what you're doing late on Fridays!  Could be trouble.

I guess the SF developers will have to chime in on this one.  I sure hope they are well rested, because we are going to be bombarding them next week! Smile

Thanks for responding, Greg!
Bill

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Let the bombardment begin! Tongue
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Still looking for help on this...bump.  Smile
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Let the bombardment begin!

I brought my flak jacket, but I'm not sure that's going to be enough Wink

Well, the first thing we need to do is make sure that the translation is happening correctly.  So, verity that before the ChildFormDialog.ShowDialog() is called the business object in question (the one you're calling Edit() on) has at least one record.  So put a break point on the ShowDialog() line and use the watch window to check the .Count of the business object before it's translated.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Ben Chase (01/04/2008)
[quote]...check the .Count of the business object before it's translated.

Welcome back, Ben!  We'll be gentle.

It is 0.  Odd.  I am using the same BO (I think) to fill the ListView.  There are five records in the ListView (Count: 5).  Where did they go?

I am suspecting the RowPopulating event...checking now...

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
That was the culprit!  I had created a "new" BO to do the work of filling the ListView.  Why?  I don't know.  So, I changed it so that the translated BO is being filled, then I use that to complete the ListView.  It seems to be working, now.

Thanks a ton for the response!  I am very glad to be moving forward again on this project!!
Bill

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
Glad you found your problem Smile
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