Catalog · How the catalog works
DatasetHelper
Class helper for TDataset
- ★ 10 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
DatasetHelper
Class helper for TDataset Functions to ease the looping of datasets, getting and setting data.
Available Functions
Selector Functions <ul> <li>ALL (All dataset rows)</li> <li>CURRENT (Current dataset row)</li> <li>SELECT (Rows that match the given expression)</li> <li>SELECTNOTEQUAL (Rows that doesnt match the given expression)</li> <li>SELECTIN (Rows that match the given expression list) </li> <li>SELECTNOTIN (Rows that doesnt match the given expression list) </li> <li>FIRST (First row of current selection) </li> <li>LAST (Last row of current selection) </li> </ul>
Row Group Functions <ul> <li>MIN (Minimum value of a field)</li> <li>MAX (Maximum value of a field)</li> <li>AVG (Average value of a fieldn)</li> <li>SUM (Sum of values of a field)</li> <li>COUNT (Row coutn of current selection) </li> <li>SETVALUE (Change value of given field to all selected rows ) </li> <li>FOREACH (Execute Anonymous procedure in all selected rows) </li> <li>DELETE (Deletes all selected rows) </li> <li>ASARRAY (Return 2D array with all information of all selected rows) </li> <li>ASLIST (Return List of 1D array with all information of all selected rows) </li> </ul>
Single Row Functions <ul> <li>SETVALUE (Change value of given field in current row) </li> <li>GETVALUE (Returns value of given field in current row) </li> <li>EXECUTE (Execute Anonymous procedure in current row) </li> <li>DELETE (Deletes current row) </li> <li>ASARRAY (Return array with all information of current row) </li> <li>RECNO (RecNo of current row in the dataset) </li> <li>CREATECOPYROW (Creates new row in dataset with the same values of the current row (Allows Ignore fields) </li> </ul>
Usage Examples
Get total record count
totalCount:=myDataset.All.Count;
Get record count of rows with category 'Other'
otherCount:=myDataset.Select('Category','Other').Count;
Get record count of rows with category 'Other' and Department = 1
otherCount:=myDataset.Select('Category','Other').Select('Department',1).Count;
Change category for all rows with category 'Other'
myDataset.Select('Category','Other').SetValue('Category','Misc');
Delete all rows with category 'Other'
myDataset.Select('Category','Other').Delete;
Get stock of first row with category 'Other'
stock:=myDataset.Select('Category','Other').First.GetValue('Stock');
Get array with name and stock of first row with category 'Other'
arr:=myDataset.Select('Category','Other').First.AsArray(['Name','Stock']);
Copy first row with category 'Other' overriding ID with value 6
myDataset.Select('Category','Other').First.CreateCopyRecord(['ID'],[6]);

