Business Object and Sorting...


Author
Message
Robin J Giltner
Robin J Giltner
StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)
Group: Forum Members
Posts: 105, Visits: 650
I have a question about the FillbyParent method and Business Object sorting.

In my Treeview I populate a list of records.  These individual records have child records that are populated through 2 tables.

The Main table has a one-to-many relationship with its direct children, and each direct child has a one-to-one relationship with its child.  This *grandchild* contains the data I need to display.  Got this working great using a FillbyParentPrimaryKey to get the child records for the one-to-many relation table, and then a FillbyParent to get all of the grandchild records of the Selected Main item.

My question is this, my sort order exists in the middle table.  I can sort the middle BusinessObject, and it sorts like I want it to, but then on the next business object I do a FillbyParent.  On the query getting passed to the Database, the parameters are in the proper order, but the data coming back form it doesn't seem to be in the order of the parameters.  Is there something I'm missing on my SQL configuration you know of, or is this something I'm going to have to do something about in code ?

Thanks

Robin Giltner

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What you're getting is actually the correct response from SQL... Unless you specify an ORDER BY on a query, the results will come back in the order of the clustered index on the server (which is the order in which the records actually reside on disk).  If you want to have the records come back in the same order as the parents, you'll need to write a manual query and join the records to the parent table (you don't have to retrieve any fields from the parent table, but the parent has to be part of the query if it's going to be used in the ORDER BY) and then order the records how you want them ordered.  The best way to create the where clause for the records is to use an "IN" and provide a list of the parent PKs in parameters (just like the FillByParent does).
Robin J Giltner
Robin J Giltner
StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)
Group: Forum Members
Posts: 105, Visits: 650
That's what I wanted to know. 

Thanks Ben.

Robin Giltner.

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