Skip to main content

INCLUDE Function

Hi there,
I have a background in ACL and in ACL, there is a function called the INCLUDE function that will include all occurrences of a specified character or characters from an existing character string.  As an example, INCLUDE(Address_Field_Name, "0123456789"), will give me all of the numeric characters from the address field, regardless of where they are located in the field or how many times they occur.
There does not appear to be an equivalent function for this in IDEA.  @spanincluding comes close but still does not work the same as the ACL INCLUDE function.  Is there a custom function for this, or I am just not finding the right function in IDEA?
Thanks in advance!
Mike

Brian Element Thu, 02/04/2021 - 12:39

If you are just looking to extract numbers only you can use @justnumbers function.  There is the @remove function but it only allows you to do one character at a time, so you can nest multiple @remove together. There is also the option to use the @RegExp function that can do something like this.  Finally I could create a custom function, let me know.

mkeiffer33 Fri, 02/05/2021 - 10:59

Hi Brian,
Would it be possible for you to create a custom INCLUDE and EXCLUDE function where I could include and exclude all occurrences of a specific character and also to where I can do it with more than one character?  That would be great!  Here is the link to the ACL webpage for how their INCLUDE function works.  I would love to have something like this in IDEA.  
Here is the link -
https://help.highbond.com/helpdocs/analytics/141/scripting-guide/en-us/…
Thanks so much!

Brian Element Fri, 02/05/2021 - 13:30

In reply to by mkeiffer33

Hi Michael, this is actually a great idea for a custom script.  Let me put something together and I will post it for you to test it out.

Brian Element Mon, 02/08/2021 - 08:05

Hi Michael, can you try these out and let me know.  I also added a third parameter to indicate if the matching is case sensitive or not.  0 is case sensitive and 1 is non-case sensitive.  

mkeiffer33 Mon, 02/08/2021 - 09:34

Hi Brian,
Thanks so much for developing these for me.  I will try it out and let you know.  Thanks again, this is awesome!

akwatdok Thu, 10/26/2023 - 04:53

Brian, does this work the same way if for example i have a list of names in a field and i want to count the number of a character appears in a field? E.g. How many times a letter Z appears in a SURNAME field.

Brian Element Thu, 10/26/2023 - 07:24

No, it doesn't work like that, here is the help:

Returns a string that includes the specified characters.

Syntax:
#cwi_Include(String1, String2, Number)

Parameters:
String1 - Grouping of characters that will be used to remove the excluded characters.
String2 - List of characters to exclude from Parameter 1.
Number - Use 0 for non-case sensitive removal and any other name for case sensitive removal.

Return Type: String

Example:
#cwi_Include("I want to remove all the vowels", "aeiou", 0)
Returns: aoeoeaeoe 

The @FindOneOf should do what you are looking for as it will return the number of times a letter appears in a string.