﻿<?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?)  » Using Parent-Child info in a Grid</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 04 Jul 2026 18:07:00 GMT</lastBuildDate><ttl>20</ttl><item><title>Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24620.aspx</link><description>If I have a Course table and a Student table that are related by Student PK such as (Simplified):&lt;br&gt;
&lt;br&gt;
[b]Course1[/b] table which has fields&lt;br&gt;
PK&lt;br&gt;
Course#&lt;br&gt;
StudentPK&lt;br&gt;
TestScore&lt;br&gt;
QuizScore&lt;br&gt;
DailyScore&lt;br&gt;
&lt;br&gt;
and [b]Student[/b] table has fields&lt;br&gt;
PK&lt;br&gt;
Name&lt;br&gt;
&lt;br&gt;
I have a stored procedure that gets the following information  using a parameter to get students in Algebra1:&lt;br&gt;
course#,Name and TestScore&lt;br&gt;
&lt;br&gt;
I want to put the the above info in a devexpress grid. I can get this far from the help I already got from the forum (I use a dummy table with the correct field names) put the info into a BO and then I use a BBS to attach it to the devgrid. But how does the test scores get back to the course table?&lt;br&gt;
&lt;br&gt;
I have simplified the layout of the tables but if we can make this work then I can apply it too the project. TIA&lt;br&gt;</description><pubDate>Mon, 14 Sep 2009 20:12:49 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24638.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
That's it. Just a way of presenting useful info to the user.&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Mon, 14 Sep 2009 20:12:49 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24637.aspx</link><description>I think I just had the AH HA Moment. The Lookup Edit is not used to look up a student--the grid uses it to lookup the student name that corresponds to that record in the grid. Is that correct?</description><pubDate>Mon, 14 Sep 2009 19:53:53 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24636.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
I only mentioned lookup edits so you can display the names associated with the Course and Student rather than the PK values. I didn't mean to imply that you would actually edit the data.&lt;br&gt;
&lt;br&gt;
Another approach (maybe better in this case) would be to extract these names and include them in your stored procedure that extracts the data for the Grades BO. After you have created the BO from the Grades table, add these extra fields as Custom Fields in your BO. Once you have added the Custom Fields and recompiled the BO they will be visible in the grids data source.&lt;br&gt;
&lt;br&gt;
In case your are not familiar here's an example of adding a couple of custom fields to a BO. Note "boPUNType" referred to below is the name of my BO.&lt;br&gt;
&lt;br&gt;
Custom Fields are very useful. You can base a BO on a table and add any amount of other info into the BO from other sources however Custom Fields are not updatable. The following example is just a couple of fields but, in this particular BO, we have about 15 Custom Fields.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
    ''' &lt;summary&gt;&lt;br&gt;
    ''' LocationInStore&lt;br&gt;
    ''' &lt;/summary&gt;&lt;br&gt;
    ''' &lt;remarks&gt;&lt;/remarks&gt;&lt;br&gt;
    &lt;Browsable(False), _&lt;br&gt;
     BusinessFieldDisplayInEditor(), _&lt;br&gt;
     Description("LocationInStore"), _&lt;br&gt;
     DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)&gt; _&lt;br&gt;
    Public ReadOnly Property [LocationInStore]() As System.String&lt;br&gt;
        Get&lt;br&gt;
            Dim loValue As Object&lt;br&gt;
            If Me.CurrentDataTable.Columns.Contains("LocationInStore") Then&lt;br&gt;
                loValue = Me.CurrentRow.Item("LocationInStore")&lt;br&gt;
            Else&lt;br&gt;
                loValue = DBNull.Value&lt;br&gt;
            End If&lt;br&gt;
&lt;br&gt;
            If loValue Is DBNull.Value Then&lt;br&gt;
                Return String.Empty&lt;br&gt;
            Else&lt;br&gt;
                Return CType(loValue, System.String)&lt;br&gt;
            End If&lt;br&gt;
        End Get&lt;br&gt;
    End Property&lt;br&gt;
&lt;br&gt;
    ''' &lt;summary&gt;&lt;br&gt;
    ''' Quarantined&lt;br&gt;
    ''' &lt;/summary&gt;&lt;br&gt;
    ''' &lt;remarks&gt;&lt;/remarks&gt;&lt;br&gt;
    &lt;Browsable(False), _&lt;br&gt;
     BusinessFieldDisplayInEditor(), _&lt;br&gt;
     Description("Quarantined"), _&lt;br&gt;
     DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)&gt; _&lt;br&gt;
    Public ReadOnly Property [Quarantined]() As Nullable(Of System.Boolean)&lt;br&gt;
        Get&lt;br&gt;
            Dim loValue As Object&lt;br&gt;
            If Me.CurrentDataTable.Columns.Contains("Quarantined") Then&lt;br&gt;
                loValue = Me.CurrentRow.Item("Quarantined")&lt;br&gt;
            Else&lt;br&gt;
                loValue = DBNull.Value&lt;br&gt;
            End If&lt;br&gt;
&lt;br&gt;
            If loValue Is DBNull.Value Then&lt;br&gt;
                Return CType(Nothing, Nullable(Of System.Boolean))&lt;br&gt;
            Else&lt;br&gt;
                Return New Nullable(Of System.Boolean)(CType(loValue, System.Boolean))&lt;br&gt;
            End If&lt;br&gt;
        End Get&lt;br&gt;
    End Property&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
   Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()&lt;br&gt;
&lt;br&gt;
        Dim boPUNType As System.Type = Me.GetType()&lt;br&gt;
&lt;br&gt;
        Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _&lt;br&gt;
            New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;br&gt;
            "LocationInStore", boPUNType), _&lt;br&gt;
            New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;br&gt;
            "Quarantined", boPUNType)}&lt;br&gt;
    End Function&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Mon, 14 Sep 2009 19:51:52 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24635.aspx</link><description>I just introduced teacher to explain what a period was. I'm starting to attack this problem and will be back for help I am sure. &lt;br&gt;
In one of your responses you mentioned a lookup edit, am I correct if I want the grid to simply look like this:&lt;br&gt;
[codesnippet]&lt;br&gt;
Course#        Period         StudentName         TestScore&lt;br&gt;
11                 1                 Buffie                     85&lt;br&gt;
11                 1                 Sally                       90&lt;br&gt;
11                 1                 Billy                        88&lt;br&gt;
...&lt;br&gt;
[/codesnippet]&lt;br&gt;
and so forth where we are only putting in the score that lookup edit is not what I want to use?&lt;br&gt;
TIA.&lt;br&gt;
I could not get the columns to line up...... sorry&lt;br&gt;</description><pubDate>Mon, 14 Sep 2009 19:24:42 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24634.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
"Period is like 8-9am is period 1 and 10-11am is period 3 which might be Algebra classes for a particular teacher"&lt;br&gt;
&lt;br&gt;
Ok, but I think you can see that having three seemingly independant Period values doesn't seem to be correct but, as I said, if your only interest is in updating a single value is the Grades table then it doesn't make much difference.&lt;br&gt;
&lt;br&gt;
I also notice you have also introduced "Teacher" who doesn't appear in any of the tables you have mentioned.&lt;br&gt;
&lt;br&gt;
It's sometimes very tough working with an existing database....&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Mon, 14 Sep 2009 17:52:51 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24633.aspx</link><description>Taking on existing data structures can be frustrating, and I have just scanned through this post and have seen some good advice from Peter.  One thing that could change a some of these answers might be if you are free to add SPROCs or updatable views.  If you cannot touch the database at all, then obviously you are 100% stuck with these structures, sprocs, and views.  But if you can add some to meet your specific needs, then it would be easier to work with.&lt;br&gt;
&lt;br&gt;
At any rate, there was a lot of good advice given here so I will just let you go with what was given for now, just thought I would throw that out there. :)</description><pubDate>Mon, 14 Sep 2009 09:52:08 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24632.aspx</link><description>OK I will work on this. Thanks. &lt;br&gt;
I did not design the data structure, I just have to use what is there. &lt;br&gt;
Period is like 8-9am is period 1 and  10-11am is period 3 which might be Algebra classes for a particular teacher.&lt;br&gt;
After some more work on this I will probably come back to this when I get some actual code and forms.....&lt;br&gt;</description><pubDate>Mon, 14 Sep 2009 08:27:03 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24631.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
A couple of questions:&lt;br&gt;
&lt;br&gt;
1) Its not clear what what "Period" means, e.g. if LinkTable.Period is the same as Course.Period then one is redundent.&lt;br&gt;
&lt;br&gt;
2) Grades.Period seems very suspect. Period has now appeared in three different tables and, it seems, they can all have independent values. Is this correct?&lt;br&gt;
&lt;br&gt;
That being said I take it that all tables have existing values and all you want to do it update the Grades.TestScore column. If this is so I would:&lt;br&gt;
.&lt;br&gt;
a) Have one Grid using a BO based on the Grades table. Populate with a stored procedure that sorts on Course.CourseName, Student.Name, Grade.Period and Grade.PositionInPeriod. Show these columns:&lt;br&gt;
&lt;br&gt;
	Grades.CoursePK - is a DevEx lookup edit to table Course&lt;br&gt;
	Grades.StudentPK - is a DevEx lookup edit to table Student&lt;br&gt;
	Grades.Period - is whatever is in that column&lt;br&gt;
	Grades.PositionInPeriod  - is whatever is in that column&lt;br&gt;
	Grades.TestScore - is a maintainable column.&lt;br&gt;
&lt;br&gt;
b) Probably be best to show the GroupHeader box in the grid and put Grades.CoursePK in there (which will be the Course.Name, not the PK of course).&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Sun, 13 Sep 2009 22:35:48 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24630.aspx</link><description>Here is the layout:&lt;br&gt;
[b]Course[/b]&lt;br&gt;
coursepk&lt;br&gt;
coursename&lt;br&gt;
period&lt;br&gt;
&lt;br&gt;
[b]LinkTable[/b]&lt;br&gt;
linkpk&lt;br&gt;
coursepk&lt;br&gt;
studentpk&lt;br&gt;
period&lt;br&gt;
&lt;br&gt;
The above table has multiple records for each course per period.&lt;br&gt;
&lt;br&gt;
[b]Student[/b]&lt;br&gt;
studentpk&lt;br&gt;
name&lt;br&gt;
&lt;br&gt;
[b]grades[/b]&lt;br&gt;
gradepk&lt;br&gt;
studentpk&lt;br&gt;
coursepk&lt;br&gt;
period&lt;br&gt;
positioninperiod&lt;br&gt;
testscore&lt;br&gt;
&lt;br&gt;
The grid(s) would have (but is fexible):&lt;br&gt;
coursename,studentname,period,testscore&lt;br&gt;
&lt;br&gt;
The only updateable field is the testscore and the data appears in positioninperiod order.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;</description><pubDate>Sun, 13 Sep 2009 20:52:42 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24629.aspx</link><description>The data structure is in place from a already purchased piece of software. The company is going to let us access that data and we want to update it outside of their program because of some issues.&lt;br&gt;
I will get the outline of the files and fields together and get back to you. Thanks</description><pubDate>Sun, 13 Sep 2009 20:06:59 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24628.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
Don't really understand the question but what I do need to know is what tables/columns will you be working with?&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Sun, 13 Sep 2009 18:49:44 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24627.aspx</link><description>oh views are not updateable. ug........ :angry: so much for my idea..... The data structure is in place, we are being allowed to do a few more things with it, I hope. &lt;br&gt;
I am going to have to think about this multiple grid idea. If you scroll down the course grid to enter scores how will I be able to keep it in sink with the Student Table so the names will be correct?&lt;br&gt;
TIA</description><pubDate>Sun, 13 Sep 2009 18:45:42 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24626.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
You can create a BO from a view but not a stored procedure (as you seem to know) however SQL Server doesn't support updatable views.&lt;br&gt;
&lt;br&gt;
I guess you could use a view and have an unbound grid and handle all the database updates manually as you move from row to row. That being said your database does need to be structured in the way I outlined.&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Sun, 13 Sep 2009 18:21:36 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24625.aspx</link><description>Ok I thought about that but the teachers are so accustomed to putting their cursor in a column say test column and putting in a score and hitting enter which takes them to the next student. The grid is in the same order as their grade book. Don't think I can change that thought pattern. &lt;br&gt;
&lt;br&gt;
How about this? Create a View that will get ALL Possible Data. Then I believe I can create a BO from that View and I then I think I could use a SP that uses the View to just get the data needed at any given time with parameters. Then I could fill the BO with the SP, then use a BBS for the gird.&lt;br&gt;
&lt;br&gt;
If that would work to get the data, would it then update the testscores?????? Or is my thoughts completely off base?&lt;br&gt;
TIA.</description><pubDate>Sun, 13 Sep 2009 18:06:57 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24624.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
Oops, a bit early in the morning. I've just reread my post and your question and I see I'm off the track a little bit.&lt;br&gt;
&lt;br&gt;
In your example "testscore, quizscore, dailyscore" would have to become part of the StudentCourse table because that's what the data refers to, i.e. it isn't Course specific its StudentCourse specific.&lt;br&gt;
&lt;br&gt;
So one grid containing the expanded StudentCourse table with the data columns Student and Course being lookup edits referencing those two tables.&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Sun, 13 Sep 2009 17:36:51 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24623.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
In that case you will three tables:&lt;br&gt;
&lt;br&gt;
Parent: 	Course&lt;br&gt;
&lt;br&gt;
Child:		StudentCourse&lt;br&gt;
&lt;br&gt;
GrandChild:	Student&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Grid1 would be populated with Course&lt;br&gt;
&lt;br&gt;
Grid2 would be populated with StudentCourse&lt;br&gt;
&lt;br&gt;
There would be no need for a Student to be included as a seperate grid. The data column Student in Grid2 would be a simple DevEx lookup edit populated from the Student table and the Course data column in StudentCouse table would not even be displayed in Grid2. Straraframe will take care of the relationships and keep the Course column (in StudentCourse) correctly populated with the Course PK.&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Sun, 13 Sep 2009 17:30:08 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24622.aspx</link><description>Oh wow. Your SP does not bring the data together it just makes sure you have the correct data from each table which then ends up in a BO and then the BBS for the grid? Correct?&lt;br&gt;
&lt;br&gt;
1. So what do you do if some data[b] from both[/b] tables are to be displayed(the first grid)?&lt;br&gt;
2. What do you do if you have a link table(I think that is what they are called)? Like this.&lt;br&gt;
studentpk, name &lt;-----&gt; studentpk,coursepk &lt;----------&gt;coursepk,coursename,testscore,quizscore,dailyscore?&lt;br&gt;
 &lt;br&gt;
I hope #2 makes sense. It is just 3 tables related thru the middle table.&lt;br&gt;
Again, thank you Peter for such a timely response and a clear response.</description><pubDate>Sun, 13 Sep 2009 16:44:49 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Using Parent-Child info in a Grid</title><link>http://forum.strataframe.net/FindPost24621.aspx</link><description>Hi Terry,&lt;br&gt;
&lt;br&gt;
We do this all the time. The approach we take is:&lt;br&gt;
&lt;br&gt;
1) Create a BO on the Course1 table.&lt;br&gt;
&lt;br&gt;
2) Create a BO on the Student table.&lt;br&gt;
&lt;br&gt;
3) Configure each BO with a proc that extracts all the data in each table.&lt;br&gt;
&lt;br&gt;
4) Point 3) can, of course, get more complicated but lets assume this is good enough for now.&lt;br&gt;
&lt;br&gt;
5) In BO.Student:&lt;br&gt;
   &gt; Set ChileAutoFilterOption to MatchCurrentRow (this will ensure that onlt Students in the current Course are displayed.&lt;br&gt;
   &gt; Set ParentRelationship so that Student is related to Course by it PK&lt;br&gt;
&lt;br&gt;
6) Create a form and drop a grid on to it and set its datasource to BBS.Course1. This becomes the forms PrimaryBusinessObject.&lt;br&gt;
&lt;br&gt;
7) Drop a second grid onto the from (we normally use a split container, one panel for each grid) and set its datasource to BBS.Student.&lt;br&gt;
&lt;br&gt;
8) In BO.Student (once its been dropped on your form) go into Properties and set ParentBusinessObject to BO.Course which is already on the form.&lt;br&gt;
&lt;br&gt;
And you're done. A nice parent child form. The same can be done for parent/child/grandchild etc.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Sun, 13 Sep 2009 15:58:16 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item></channel></rss>