How to prevent a Relation from Displaying A child table

I have a group of 5 nested tables which create a five level expansion of Table1->Table2->Table3->Table4->Table5. This is done with 4 relations. I am also using a set of computed columns to calculate the sum of a set of columns from Table 3 to Table 2 to table 1. It appears computed columns do not work if they are computed from other computed columns (ADO limitation?) So I need to create a relation between Table 1 and Table 3. this fixes my expression issue but creates another nesting directly between table 1 and 3. Is there a way to prevent the grid from using this relatinship when determining which nestings to expand?

3 Replies

BL Bill Langlais July 31, 2006 03:39 AM UTC

Hi,

I tried the following and it seems to work. Any problems with this approach or can you recomend a better approach?

//Called in the GridGroupingControls Initialization code


for(int Inc = 0 ; Inc < P_GridSkiResults->TableDescriptor->Relations->Count ; ++Inc) {
GridRelationDescriptor *grd = P_GridSkiResults->TableDescriptor->Relations->Item[Inc];

if(String::Compare(grd->ChildTableDescriptor->Name, DailyTotalsTable) == 0) {
P_GridSkiResults->TableDescriptor->Relations->Remove(grd);
}
}


AD Administrator Syncfusion Team July 31, 2006 12:26 PM UTC

What you did is OK, but you can try using the relationName as the indexer to retrieve the relation instead of searching for it. In C#, the code would be:

grid.TableDescriptor.Relations.Remove(grid.TableDescriptor.Relations[relationName]);


Here, relationName would be a string that holds the name that was given to the relation when you created it. So, maybe something like this would also work if the indexer accepts a string in MCPP as it does in C#:

P_GridSkiResults->TableDescriptor->Relations->Remove(P_GridSkiResults->TableDescriptor->Relations->Item[relationName]);



BL Bill Langlais July 31, 2006 08:36 PM UTC


Hi,

That should owrk fine in C++. Thanks that is more elegent.

>What you did is OK, but you can try using the relationName as the indexer to retrieve the relation instead of searching for it. In C#, the code would be:

grid.TableDescriptor.Relations.Remove(grid.TableDescriptor.Relations[relationName]);


Here, relationName would be a string that holds the name that was given to the relation when you created it. So, maybe something like this would also work if the indexer accepts a string in MCPP as it does in C#:

P_GridSkiResults->TableDescriptor->Relations->Remove(P_GridSkiResults->TableDescriptor->Relations->Item[relationName]);


Loader.
Up arrow icon