﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Parent - Child BO and Trying to Update Child</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 17 May 2026 02:43:15 GMT</lastBuildDate><ttl>20</ttl><item><title>Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26749.aspx</link><description>[codesnippet]      &lt;br&gt;
 If EventEntriesRodeoBO1.MoveFirst Then&lt;br&gt;
            For Each loRodeo As EventEntriesRodeoBO In Me.EventEntriesRodeoBO1.GetEnumerable&lt;br&gt;
               &lt;br&gt;
                Select Case EventEntriesRodeoBO1.eventCD&lt;br&gt;
                    Case "BB"&lt;br&gt;
                        ContestantsRodeoBO1.EventBB = EventEntriesRodeoBO1.eventCD&lt;br&gt;
                    Case "BR"&lt;br&gt;
                        ContestantsRodeoBO1.EventBR = EventEntriesRodeoBO1.eventCD&lt;br&gt;
             End Select&lt;br&gt;
&lt;br&gt;
            Next&lt;br&gt;
        End If&lt;br&gt;
ContestantsRodeoBO1.Save()ContestantsRodeoBO1.Save()&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
I am trying to iterate thru the parent(evententriesrodeobo1) and update a column in the child(contestantrodeobo1).  This code is called from the click of a button on a form. Please note the attached screenshots. The parent child relationship works on the form so what am I missing in the code? I have traced the code and it seems to be doing what I need it to do except the data does not end up in the child in the database?????&lt;br&gt;
I must be brain dead since this seems to be trivial BUT.?????? TIA</description><pubDate>Fri, 30 Apr 2010 13:11:43 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost27053.aspx</link><description>Related to formatting code in the forum. I just found another method. Not as pretty as using Ivan's Portuguese Notepad2, but it saves having to use non-breaking spaces. just put &amp;lt;pre&amp;gt; tags just inside the codesnippet tags. This also doesn't completely fubar your formatting if you use preview.&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;pre&gt;//-- code just typed in via forum editor&lt;br&gt;
public class BetterForumEditing : SF.WickedCoolEditor&lt;br&gt;
   public BetterForumEditing()&lt;br&gt;
   {&lt;br&gt;
      this.Property1 = "No reason to set this here...";&lt;br&gt;
   }&lt;br&gt;
}[/codesnippet]&lt;br&gt;
&lt;br&gt;
As you can see, it indents nicely, but there lines are spaces a bit far apart. Not sure which I like best: using non-breaking spaces, using the  &amp;lt;pre&amp;gt; tag (which also works without codesnippet too) or learning Portuguese.  :P</description><pubDate>Fri, 30 Apr 2010 13:11:43 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26817.aspx</link><description>This is a great community out here.  Thanks for all of your contributions! :)</description><pubDate>Mon, 12 Apr 2010 09:25:59 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26799.aspx</link><description>I want to thank everyone for their help on my parent - child problem. It was great help and I learned a great deal. Thanks again I have it working and I understand how to do it next time.</description><pubDate>Fri, 09 Apr 2010 14:24:27 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26798.aspx</link><description>Narf!</description><pubDate>Fri, 09 Apr 2010 13:19:46 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26797.aspx</link><description>Oh, I bet I know the diff. Yours is probably in Portuguese.   :P</description><pubDate>Fri, 09 Apr 2010 12:21:40 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26796.aspx</link><description>I can sell copies of mine... non-refundable. :P</description><pubDate>Fri, 09 Apr 2010 12:04:17 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26794.aspx</link><description>Annoyingly pragmatic.</description><pubDate>Fri, 09 Apr 2010 11:39:31 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26793.aspx</link><description>Not so good... I am on W7 64bit.&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
public partial class Invoicing_Export : Aspire.UI.Windows.Forms.AspireBaseForm&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public Invoicing_Export()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;InitializeComponent();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
This is the same code with the non-breaking spaces included.</description><pubDate>Fri, 09 Apr 2010 11:38:45 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26792.aspx</link><description>I went the notepad2 route, also.  Here is my pasting of code from notepad2 which was originally from VS2k8:&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
public partial class Invoicing_Export : Aspire.UI.Windows.Forms.AspireBaseForm&lt;br&gt;
    {&lt;br&gt;
        public Invoicing_Export()&lt;br&gt;
        {&lt;br&gt;
            InitializeComponent();&lt;br&gt;
        }&lt;br&gt;
    }&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
How does that look?&lt;br&gt;</description><pubDate>Fri, 09 Apr 2010 11:36:54 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26791.aspx</link><description>I just tried out notepad2 and it's not keeping tabs/extra spaces either. Could there be some setting I'm missing? Or maybe this works with Vista/Win7 and not XP?</description><pubDate>Fri, 09 Apr 2010 11:33:29 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26788.aspx</link><description>Oh, never thought of that... I use Notepad2.exe (&lt;A href="http://www.flos-freeware.ch/notepad2.html"&gt;http://www.flos-freeware.ch/notepad2.html&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;It was recommended to me by Sir Steve Taylor. :)</description><pubDate>Fri, 09 Apr 2010 07:44:08 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26786.aspx</link><description>I use Notepad++ which works well with various programming languages.&lt;/P&gt;&lt;P&gt;You can download it (free) from:&lt;/P&gt;&lt;P&gt;&lt;A href="http://notepad-plus.sourceforge.net/uk/site.htm"&gt;http://notepad-plus.sourceforge.net/uk/site.htm&lt;/A&gt;</description><pubDate>Fri, 09 Apr 2010 06:40:00 GMT</pubDate><dc:creator>Russell Scott Brown</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26781.aspx</link><description>Hmmm....this didn't work for me. I typed in some text into notepad, selected all, copied into codesnippet (tried a quote too)...indentation was lost.  You have some fancy-mancy notepad? ;)</description><pubDate>Thu, 08 Apr 2010 19:09:10 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26777.aspx</link><description>This is what I do:&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;P&gt;I usually just edit the code in a .txt file with Notepad&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Than I copy it from there to the browser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If I want to copy code from VS&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I copy it to the .txt file too first&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; And then copy it from there to the browser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; And this usually works fine&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;Hope it helps&lt;BR&gt;&lt;/P&gt;&lt;P&gt;[/codesnippet]</description><pubDate>Thu, 08 Apr 2010 15:07:17 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26775.aspx</link><description>I just use html non-breaking space code: ampersand nbsp;&lt;br&gt;
&lt;br&gt;
Be sure to copy the content as these are removed if you preview the post.&lt;br&gt;
&lt;br&gt;
I'd love to know if there is an easier way.</description><pubDate>Thu, 08 Apr 2010 12:42:20 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26774.aspx</link><description>If anyone knows how to get the code spacing/indentation to work properly, please let me know.  I tried placing a period at the beginning of each line, but all of the spacing following it was whacked.  Sorry for the poor indentation.  Hope you can still read it.</description><pubDate>Thu, 08 Apr 2010 09:31:48 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26773.aspx</link><description>Here's what I would do (C#, sorry):&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
foreach (EventEntriesRoderBO loRodeo in EventEntriesRodeoBO1.GetEnumerable())&lt;br&gt;
{&lt;br&gt;
.   ContestantsRodeoBO loContestants = new ContestantsRodeoBO();&lt;br&gt;
.   loContestants.FillByParentPrimaryKey(loRodeo.contestantID);&lt;br&gt;
.   if (loContestants.Count &gt; 0)&lt;br&gt;
.   {&lt;br&gt;
.       loContestants.Edit();   'per Edhy, this is not necessary...just showing it for clarity&lt;br&gt;
.       switch (loRodeo.eventCD)&lt;br&gt;
.       {&lt;br&gt;
.           case "BB":&lt;br&gt;
.               loContestants.EventBB = loRodeo.eventCD;&lt;br&gt;
.               break;&lt;br&gt;
.           case ...&lt;br&gt;
.       }&lt;br&gt;
.       loContestants.Save();&lt;br&gt;
.   }&lt;br&gt;
}&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
I find it a lot easier to manually handle the filling of child BOs.  I often get lost in the automated attempts to do so.&lt;br&gt;
&lt;br&gt;
Hope this helps,&lt;br&gt;
Bill</description><pubDate>Thu, 08 Apr 2010 09:30:09 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26772.aspx</link><description>This Child BO is the ContestantsRodeoBO and the parent is the EventEntriesRodeoBO. &lt;br&gt;
&lt;br&gt;
I was trying to put the Me.ContestantsRodeoBO1.FillByParentPrimaryKey(loRodeo.contestantId) in the navigated of the EventEntriesRodeoBO but of course it knows nothing about the object loRodeo. I tried a couple of other combinations but can not seem to get how to get all the references correct.&lt;br&gt;
This was the last try but not working? Remember the parent is Event.... and the child is contestant......&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
    Private Sub EventEntriesRodeoBO_Navigated(ByVal e As MicroFour.StrataFrame.Business.NavigatedEventArgs) Handles MyBase.Navigated&lt;br&gt;
        ContestantsRodeoBO.FillByParentPrimaryKey(Me.contestantId)&lt;br&gt;
    End Sub&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
Thanks for any help.</description><pubDate>Thu, 08 Apr 2010 09:07:04 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26770.aspx</link><description>Well it is not going to be easy to figure out without a sample, but the Me.EventEntriesRodeoBO1 BO should have been already filled and filtered using Me.ContestantsRodeoBO1.FillByParentPrimaryKey(loRodeo.contestantId) but again, that should not affect the FOR loop since.&lt;br&gt;
&lt;br&gt;
Just to be clear, the child BO Me.EventEntriesRodeoBO1 should already have all the records related to the parent before going to the FOR loop.  I usually put the FillByParentprimaryKey() in the Navigated event of the parent BO.&lt;br&gt;
&lt;br&gt;
If still does not work, see if you can build a quick sample using the SF sample database.  I have done that many times and in a more difficult way using the BO.Filter() which is very powerful and dangerous if you are not focus. :D</description><pubDate>Wed, 07 Apr 2010 14:26:14 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26769.aspx</link><description>As a follow up. Unless I put the following code after the For each lorodeo&lt;br&gt;
&lt;br&gt;
Me.ContestantsRodeoBO1.FillByParentPrimaryKey(loRodeo.contestantId)&lt;br&gt;
&lt;br&gt;
Nothing gets updated at all no matter where I put the save. Does that mean my parent child is not working? It does work on the form with the toolstrip.</description><pubDate>Wed, 07 Apr 2010 13:25:24 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26768.aspx</link><description>Sorry I have been so late on this but I have been working on another issue and finally resolved it.&lt;br&gt;
&lt;br&gt;
Edhy this is all the code. Just in the click of a button and the parent child relationship set up on the form. If I move the Save inside the loop the data gets saved. If I move it out side the loop only the last data gets saved. When I was talking about filtering I was referring to SF's automatic filtering of the child records not me filtering anything.&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
        If EventEntriesRodeoBO1.MoveFirst Then&lt;br&gt;
            For Each loRodeo As EventEntriesRodeoBO In Me.EventEntriesRodeoBO1.GetEnumerable&lt;br&gt;
               &lt;br&gt;
                Select Case loRodeo.eventCD&lt;br&gt;
                    Case "BB"&lt;br&gt;
                        ContestantsRodeoBO1.EventBB = loRodeo.eventCD&lt;br&gt;
                    Case "BR"&lt;br&gt;
                        ContestantsRodeoBO1.EventBR = loRodeo.eventCD&lt;br&gt;
                    Case "GB"&lt;br&gt;
                        ContestantsRodeoBO1.EventGB = loRodeo.eventCD&lt;br&gt;
                    Case "RB"&lt;br&gt;
                        ContestantsRodeoBO1.EventRB = loRodeo.eventCD&lt;br&gt;
                   Case "SR"&lt;br&gt;
                        ContestantsRodeoBO1.EventSR = loRodeo.eventCD&lt;br&gt;
                    Case "SW"&lt;br&gt;
                        ContestantsRodeoBO1.EventSW = loRodeo.eventCD&lt;br&gt;
                    Case "TD"&lt;br&gt;
                        ContestantsRodeoBO1.EventTD = loRodeo.eventCD&lt;br&gt;
                    Case "TR"&lt;br&gt;
                        ContestantsRodeoBO1.EventTR = loRodeo.eventCD&lt;br&gt;
                End Select&lt;br&gt;
&lt;br&gt;
               ' ContestantsRodeoBO1.Save()&lt;br&gt;
            Next&lt;br&gt;
        End If&lt;br&gt;
&lt;br&gt;
       ' ContestantsRodeoBO1.Save()&lt;br&gt;
[/codesnippet]&lt;br&gt;</description><pubDate>Wed, 07 Apr 2010 13:13:51 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26762.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
You have to be very careful when using the BO.Filter since it may get you the wrong data.  &lt;br&gt;
&lt;br&gt;
If you have your relationship setup correctly, then you don't have to use the BO.Filter.  If possible please post the whole code so we can have a better look at what you are doing.  Saving the record inside the loop may not be the best approach based on how you are setting the whole scenario.</description><pubDate>Tue, 06 Apr 2010 13:42:54 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26761.aspx</link><description>Interesting. I moved the save() into the loop and it worked. Is that because the child table has been filtered with the parent child relationship and needs to get saved before the next filter? When it comes out of the loop would the child table be filtered and that is why I only got one record saved? I am looking to understand this.&lt;br&gt;
&lt;br&gt;
Thanks again for all of the help.</description><pubDate>Tue, 06 Apr 2010 13:24:39 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Parent - Child BO and Trying to Update Child</title><link>http://forum.strataframe.net/FindPost26760.aspx</link><description>[codesnippet]&lt;br&gt;
If EventEntriesRodeoBO1.MoveFirst Then&lt;br&gt;
            For Each loRodeo As EventEntriesRodeoBO In Me.EventEntriesRodeoBO1.GetEnumerable&lt;br&gt;
               &lt;br&gt;
                Select Case loRodeo.eventCD&lt;br&gt;
                    Case "BB"&lt;br&gt;
                        ContestantsRodeoBO1.EventBB = loRodeo.eventCD&lt;br&gt;
                    Case "BR"&lt;br&gt;
                        ContestantsRodeoBO1.EventBR = loRodeo.eventCD&lt;br&gt;
                  End Select&lt;br&gt;
&lt;br&gt;
            Next&lt;br&gt;
        End If&lt;br&gt;
&lt;br&gt;
        ContestantsRodeoBO1.Save()&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
I changed my code to the above but still no luck. I did get some info saved in 1 child record. Now the parent is moving but the child record is not? Can that happen? Do I somehow have to navigate to the child record? If so how come the toolbar on the form works?&lt;br&gt;
&lt;br&gt;
Also, the relationship is 1 to 1 so I don't have to iterate thru more then 1 child record. &lt;br&gt;
I once had a problem when a parent did not have any records in it so now I can check that with moving to the first record. I know I could use count but this is just something I do.&lt;br&gt;
&lt;br&gt;
TIA.&lt;br&gt;
&lt;br&gt;</description><pubDate>Tue, 06 Apr 2010 12:57:02 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item></channel></rss>