StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
Business Objects and Data Access (How do I?)
»
Parent - Child BO and Trying to Update Child
Parent - Child BO and Trying to Update Child
Post Reply
Like
0
Prev
1
2
3
4
Next
Jump To Page
Parent - Child BO and Trying to Update Child
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Terry Bottorff
Terry Bottorff
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 448,
Visits: 12K
Sorry I have been so late on this but I have been working on another issue and finally resolved it.
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.
If EventEntriesRodeoBO1.MoveFirst Then
For Each loRodeo As EventEntriesRodeoBO In Me.EventEntriesRodeoBO1.GetEnumerable
Select Case loRodeo.eventCD
Case "BB"
ContestantsRodeoBO1.EventBB = loRodeo.eventCD
Case "BR"
ContestantsRodeoBO1.EventBR = loRodeo.eventCD
Case "GB"
ContestantsRodeoBO1.EventGB = loRodeo.eventCD
Case "RB"
ContestantsRodeoBO1.EventRB = loRodeo.eventCD
Case "SR"
ContestantsRodeoBO1.EventSR = loRodeo.eventCD
Case "SW"
ContestantsRodeoBO1.EventSW = loRodeo.eventCD
Case "TD"
ContestantsRodeoBO1.EventTD = loRodeo.eventCD
Case "TR"
ContestantsRodeoBO1.EventTR = loRodeo.eventCD
End Select
' ContestantsRodeoBO1.Save()
Next
End If
' ContestantsRodeoBO1.Save()
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi Terry,
You have to be very careful when using the BO.Filter since it may get you the wrong data.
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.
Edhy Rijo
Reply
Like
0
Terry Bottorff
Terry Bottorff
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 448,
Visits: 12K
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.
Thanks again for all of the help.
Reply
Like
0
Terry Bottorff
Terry Bottorff
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 448,
Visits: 12K
If EventEntriesRodeoBO1.MoveFirst Then
For Each loRodeo As EventEntriesRodeoBO In Me.EventEntriesRodeoBO1.GetEnumerable
Select Case loRodeo.eventCD
Case "BB"
ContestantsRodeoBO1.EventBB = loRodeo.eventCD
Case "BR"
ContestantsRodeoBO1.EventBR = loRodeo.eventCD
End Select
Next
End If
ContestantsRodeoBO1.Save()
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?
Also, the relationship is 1 to 1 so I don't have to iterate thru more then 1 child record.
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.
TIA.
Reply
Like
0
Terry Bottorff
Terry Bottorff
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 448,
Visits: 12K
WOW. Thanks for ALL the QUICK replies...... Let me get a grip on what you have replied and I will respond. Thanks again......
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Your are welcome Bill.
Terry, I just noticed that you are basically assigning loRodeo.eventCD to "BB" & "BR" events, if that is the case, you can simplify the code by using an IF..ENDIF or a single case "BB","BR" to speed up the process a bit if you need to.
Edhy Rijo
Reply
Like
0
Bill Cunnien
Bill Cunnien
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 785,
Visits: 3.6K
There is no need to Edit/Save the BO in each case option. The BO will change its EditingState when you assign a value to any of its properties, then do one save out of the FOR loop.
Good to know...thanks!
Reply
Like
0
Bill Cunnien
Bill Cunnien
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 785,
Visits: 3.6K
Edhy beat me to the fix...good job!
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi Bill,
There is no need to Edit/Save the BO in each case option. The BO will change its EditingState when you assign a value to any of its properties, then do one save out of the FOR loop.
Edhy Rijo
Reply
Like
0
Bill Cunnien
Bill Cunnien
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 785,
Visits: 3.6K
Wait...one other thing...
Select Case loRodeo.eventCD
Case "BB"
ContestantsRodeoBO1.Edit()
ContestantsRodeoBO1.EventBB = loRodeo.EventCD
ContestantsRodeoBO1.Save()
Case "BR"
etc.
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Prev
1
2
3
4
Next
Jump To Page
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search