Skip to content

Kline777/DatasetHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DatasetHelper

Class helper for TDataset Functions to ease the looping of datasets, getting and setting data.

Available Functions

Selector Functions
  • ALL (All dataset rows)
  • CURRENT (Current dataset row)
  • SELECT (Rows that match the given expression)
  • SELECTNOTEQUAL (Rows that doesnt match the given expression)
  • SELECTIN (Rows that match the given expression list)
  • SELECTNOTIN (Rows that doesnt match the given expression list)
  • FIRST (First row of current selection)
  • LAST (Last row of current selection)

Row Group Functions

  • MIN (Minimum value of a field)
  • MAX (Maximum value of a field)
  • AVG (Average value of a fieldn)
  • SUM (Sum of values of a field)
  • COUNT (Row coutn of current selection)
  • SETVALUE (Change value of given field to all selected rows )
  • FOREACH (Execute Anonymous procedure in all selected rows)
  • DELETE (Deletes all selected rows)
  • ASARRAY (Return 2D array with all information of all selected rows)
  • ASLIST (Return List of 1D array with all information of all selected rows)

Single Row Functions

  • SETVALUE (Change value of given field in current row)
  • GETVALUE (Returns value of given field in current row)
  • EXECUTE (Execute Anonymous procedure in current row)
  • DELETE (Deletes current row)
  • ASARRAY (Return array with all information of current row)
  • RECNO (RecNo of current row in the dataset)
  • CREATECOPYROW (Creates new row in dataset with the same values of the current row (Allows Ignore fields)

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]);

About

Class helper for TDataset

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages