[This is preliminary documentation and is subject to change.]

Used to send a custom filter to the database

Namespace:  Firefly.Box.Data.Advanced
Assembly:  Firefly.Box (in Firefly.Box.dll) Version: 3.4.23.6473 (3.4.23.6473)

Syntax

C#
public delegate void CustomFilterCollector(
	string filter,
	params Object[] args
)
Visual Basic (Declaration)
Public Delegate Sub CustomFilterCollector ( _
	filter As String, _
	ParamArray args As Object() _
)
Visual C++
public delegate void CustomFilterCollector(
	String^ filter, 
	... array<Object^>^ args
)

Parameters

filter
Type: System..::.String
args
Type: array< System..::.Object >[]()[]

Remarks

For a complete explanation see SendFilterTo(CustomFilterCollector)

Examples

CustomMemberFilter
This example is in the form of Unit Tests. It references the NUnit framework. This framework can be downloaded from www.NUnit.org. For more information about unit testing visit: www.NUnit.org.
This example is based on test data. The code for the entities included in this test data can be found in the documentation of Entity
CopyC#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Firefly.Box.Data;
using Firefly.Box.Data.Advanced;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
{
    [TestFixture]
    public class CustomFilterMemberDemo
    {
        [Test]
        public void UsageOfCustomMemberDemo()
        {
            var employees = new Pubs.Employees();
            employees.InitializeWithTestData();
            var bp = new BusinessProcess
            {
                From = employees
            };
            bp.Where.Add("{0}", new DBIn(employees.JobId,1,3,5,7));//See the DBIn class below
            bp.Run();
            bp.Counter.ShouldBe(12);
        }

        class DBIn : ICustomFilterMember
        {
            NumberColumn _column;
            Number[] _values;

            public DBIn(NumberColumn column, params Number[] values)
            {
                _values = values;
                _column = column;
            }

            public void SendFilterTo(CustomFilterCollector sendFilterString)
            {
                var args = new ArrayList();
                var inFunctionArguments = "";
                args.Add(_column);
                // Create the inside of the in method syntax according to the number of parameters received in the values.
                //For a dynamic number of parameters - for Example for three parameters it should look like "{1}, {2}, {3}
                foreach (var value in _values)
                {
                    if (inFunctionArguments.Length != 0)
                        inFunctionArguments += ", ";
                    inFunctionArguments += "{" + args.Count + "}";
                    args.Add(value);
                }
                sendFilterString("{0} in (" + inFunctionArguments + ")", args.ToArray());
            }
        }
    }
}

See Also