Hi all,
I have been trying to figure out how to query a table and filter based on a DateTime field with a 'greater than' comparison operator
I am running the code below as a test and I can get an individual record when the supplied DateTime matches (equality operator.) But how would you specify other kinds of comparison operators such as greater than, not equal to, less than or equal to etc.
public static void RangeTest()
{
var client = new QueryServiceClient();
var dataSource = new QueryDataSourceMetadata
{
Table = "CustTable",
Name = "CustTable",
HasRelations = false,
Enabled = true,
DynamicFieldList = true // get all fields
};
var range = new QueryDataRangeMetadata
{
TableName = "CustTable",
FieldName = "modifiedDateTime",
Value = "1/17/2013 9:51:22 PM",
Enabled = true
};
dataSource.Ranges = new QueryRangeMetadata[] { range };
var query = new QueryMetadata
{
QueryType = QueryType.Join,
DataSources = new[] { dataSource }
};
Paging paging = null;
var dataSet = client.ExecuteQuery(query, ref paging);
Console.WriteLine(dataSet.Tables[0].Rows.Count);
}