Criteria Operator

Is there a way to get the a Criteria operator to act like a "Contains" operator? Need to get only customer names that contain a specific word in their name. How else could I accomplish this task?

1

Comments

2 comments
  • Hi Matteo,

    The closest I can get to a "Contains" operator is to use the Search option in the criteria editor.

    In this example, I have searched for "kids" and found 27 members containing "kids".

    I know this is not exactly the operator you requested, but unfortunately there simply isn't a "Contains" operator. My example won't be dynamic and won't automatically pick up new members containing "kids".

    Note: If you try out the 'Custom values' option in this dialog, and combine it with a "Between" operator you can achieve at least a dynamic "Begins with" operator. See this article: https://community.targit.com/hc/en-us/articles/360017863118-Criteria-range-with-Custom-values

    BR / Ole

    0
  • Hi Matteo

    You could create the criteria in your Data Warehouse:
    If you create a column in the table where the customer name dimensions are stored, you could do something like this perhaps? But probably depends, on whether it is something that will be used often or not. 

    DECLARE @string1 NVARCHAR(20)
    SET @string1 = 'Kids'


    UPDATE <table>
    SET <Customergroup> = CASE
    WHEN <customername> LIKE '%' + @string1 + '%' THEN
    @string1
    ELSE 'Others'
    END

    And then create a fact table dimension for Customergroup, then you'll be able to select it as an equal to "kids" criteria in Targit. 

    Should you find yourself in need of creating other customer groups, you can just add more @strings and add to the case when statement like this

    DECLARE @string1 NVARCHAR(20)
    SET @string1 = 'Kids'

    DECLARE @string2 NVARCHAR(20)
    SET @string2 = 'Adults'

    UPDATE <table>
    SET customertype = CASE
    WHEN <customername> LIKE '%' + @string1 + '%' THEN
    @string1
    WHEN <customername> LIKE '%' + @string2 + '%' THEN
    @string2
    ELSE 'Others'
    END

     

    But it probably all depends on how many groups you'll need, and whether or not the customer can be in several groups. It is also highly likely the script can be done smarter, but that's above my limits then :) 

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post