1

I currently have a 4 column table with: Product, Count, Date, BusinessUnit

Product, Count, Date, BusinessUnit
Mouse, 100, 2014-05-1, StoreBB
Mouse, 120, 2014-06-01, StoreTBB
Keyboard, 130, 2014-06-21, StoreBB
Keyboard, 10, 2014-06-01, StoreTBB

Using a SSJS complex filter, I wanna be able to select those who purchased a mouse in May from BusinessUnit StoreTBB. The sample below filters the date and BusinessUnit fine, but when I try to add the Product property on the RightOperand I get errors.

 var complexfilterBB = {

                LeftOperand:{
                    Property:"Date",
                    SimpleOperator:"greaterThanOrEqual",
                    Value: "2014-05-01"
                },
                LogicalOperator:"AND",
                RightOperand:{
                    Property:"Date",
                    SimpleOperator:"lessThanOrEqual",
                    Value: "2014-06-30",
                    Property: "BusinessUnit", 
                    SimpleOperator: "equals", 
                    Value: "StoreTBB"
                }

    };

How can I perform a complex filter with a date range and two or more properties?

2
  • is this question related to exact target?
    – Rao
    Commented Jun 23, 2014 at 17:59
  • Yes, using the ExactTarbet Platform.
    – user5105
    Commented Jun 23, 2014 at 18:04

2 Answers 2

1

Will something like this work?:

var complexfilterBB = {

            LeftOperand:{
                Property:"Date",
                SimpleOperator:"greaterThanOrEqual",
                Value: "2014-05-01"
            },
            LogicalOperator:"AND",
            RightOperand:{
                LeftOperand:{
                    Property:"Date",
                    SimpleOperator:"greaterThanOrEqual",
                    Value: "2014-05-01"
                },
                LogicalOperator:"AND",
                RightOperand:{
                    Property:"Date",
                    SimpleOperator:"lessThanOrEqual",
                    Value: "2014-06-30",
                    Property: "BusinessUnit", 
                    SimpleOperator: "equals", 
                    Value: "StoreTBB"
                }
            }

};

If not, you may need to work with the ComplexFilterPart object to build these parts together as API Objects.

1

you will need to build multiple complex filters to get this and combine into a single one. This can be done without creating a new variable, but I find it easier to reference and troubleshoot using multiple variables. See below sample:

var filter = {
            LeftOperand:{
                Property:"Date",
                SimpleOperator:"greaterThanOrEqual",
                Value: "2014-05-01"
            },
            LogicalOperator:"AND",
            RightOperand:{
                LeftOperand:{
                    Property:"Date",
                    SimpleOperator:"greaterThanOrEqual",
                    Value: "2014-05-01"
                }
           };

var complexfilterBB = {
            LeftOperand: filter,
            LogicalOperator:"AND",
                RightOperand:{
                    Property:"Date",
                    SimpleOperator:"lessThanOrEqual",
                    Value: "2014-06-30",
                    Property: "BusinessUnit", 
                    SimpleOperator: "equals", 
                    Value: "StoreTBB"
                }
            };

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .