Last active
November 22, 2018 15:19
-
-
Save bjoerntx/64ea50ee1d718ab2824a8b5ea3a3b87a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set the DataSourceManager master table | |
// in order to retrieve the available column names | |
dsManager.MasterDataTableInfo = dsManager.DataTables[cbMergeBlocks.Text]; | |
// create a new MergeBlockInfo to specify instructions | |
MergeBlockInfo mergeBlockInfo = new MergeBlockInfo(cbMergeBlocks.Text); | |
// the SortingInstructions specify how the block should be sorte | |
// Sorting: Ascending by Price | |
mergeBlockInfo.SortingInstructions = | |
new List<TXTextControl.DocumentServer.DataShaping.SortingInstruction>() | |
{ | |
new TXTextControl.DocumentServer.DataShaping.SortingInstruction( | |
"Price", | |
TXTextControl.DocumentServer.DataShaping.SortOrder.Ascending) | |
}; | |
// the Filters define which rows are displayed | |
// Filter: Price > 500 | |
mergeBlockInfo.Filters = | |
new List<TXTextControl.DocumentServer.DataShaping.FilterInstruction>() | |
{ | |
new TXTextControl.DocumentServer.DataShaping.FilterInstruction( | |
"Price", | |
TXTextControl.DocumentServer.DataShaping.RelationalOperator.GreaterThan, | |
500 | |
) | |
}; | |
// the BlockMergingCondition can be used to conditionally render a block | |
// based on a condition in the parent table | |
// Condition: If Name property is Test Report | |
mergeBlockInfo.BlockMergingCondition = | |
new List<TXTextControl.DocumentServer.DataShaping.FilterInstruction>() | |
{ | |
new TXTextControl.DocumentServer.DataShaping.FilterInstruction( | |
"Name", | |
TXTextControl.DocumentServer.DataShaping.RelationalOperator.Equals, | |
"Test Report" | |
) | |
}; | |
// specify the column names | |
mergeBlockInfo.ColumnNames = dsManager.PossibleMergeFieldColumns.Select( | |
column => column.ColumnName).ToList(); | |
// define the block itself | |
MergeBlockSettings blockSettings = new MergeBlockSettings(BlockTemplateType.TableRow, true); | |
// insert the block | |
dsManager.InsertMergeBlock(textControl1, mergeBlockInfo, blockSettings); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment