In the example below we queried the Makers table. The result is ordered in descending order and there is only one row because we set the Start parameter to 0 and MaxLength to 1.¶
For example if you need a more complex query, containing multiple AND/OR conditions like "(X OR Y OR Z) AND W", you can use Blocks option. Check the code sample below.¶
varofferCountByDayTable=$Database.Get({Parameters:{TargetSchema:'OFR',TargetTable:'Offers'},Columns:[{Name:"Day",Expression:"DateTrunc('Day', OfferDate)"},{Name:"Amount",Expression:"Count(DateTrunc('Day', OfferDate))"}],Order:[{Name:"DateTrunc('Day',OfferDate)",Type:'Ascending'}]});offerCountByDayTable.Each(function(){console.info(this.Amount+' offers made on the date '+this.Day.toISOString());});