/// <summary> /// Selects records from a RecordSource using a user provided whereClause. The user /// is assumed to know the record type. For example with a text file input the record /// type is the generic DataRecord so a filter might be "record.Key[0] == 'A'" to filter /// all records except those that begin with 'A'. /// </summary> /// <param name="input">The input RecordSource.</param> /// <param name="whereClause">The select clause</param> /// <returns>A RecordSource for further processing</returns> public RecordSource SelectFilter(RecordSource input, string whereClause) { whereClause = whereClause.Replace("^", "\""); DynamicRecordFilter filter = new DynamicRecordFilter(this, whereClause); filter.AddInput(input.InternalSource); RecordSource source2Bfiltered = new RecordSource(this); source2Bfiltered.InternalSource = filter; return source2Bfiltered; }
/// <summary> /// Filters the RecordSource by using a user proviced CSharpFilterFile. The IRecordsFilter /// within the file is compiled on the fly and inserted after the input RecordSource. If /// a non-existant file is provided the method will print template file which can be modified /// by the user. /// </summary> /// <param name="input">The input RecordSource.</param> /// <param name="cSharpFilterFile">The csharp file containing a IRecordFilter definition.</param> /// <returns>A RecordSource for further processing</returns> public RecordSource FilterByCSharpSnippet(RecordSource input, string cSharpFilterFile) { DynamicRecordFilter filter = new DynamicRecordFilter(cSharpFilterFile, this); filter.AddInput(input.InternalSource); RecordSource source2Bfiltered = new RecordSource(this); source2Bfiltered.InternalSource = filter; return source2Bfiltered; }