Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Overview

Converts all rows in table to return value of given callback function.

Array<any> myDataTable.Map(fn: (row: DataRow) => any)

Converts all rows in table to return value of given callback function.

Array<any> myDataTable.Map(fn: (row: DataRow, i: number) => any)

Arguments

(row: DataRow) => any fn
Function to call for every data row.

Remarks

If callback is null, error is thrown.

Example

Convert all rows

var table = $Database.Get({
    Parameters : {
        TargetSchema : 'HR',
        TargetTable : 'Groups'
    }
});

var allRows = table.Map(function (row) {
    return {
        id : row.Id,
        name : row.Name
    };
});

// allRows is now [ {id:123, name:xxx}, {id:456, name:yyy}]
  • No labels