TiKiLa Data & String Manipulation

An overview of the data and string manipulations you can perform with TiKiLa

 
 
 

TiKiLa Data & String Manipulation Functions

 

cast(item_1, type)

This function lets you cast an item to a different type. Valid types are: string, integer, float

 

Example: cast(”12345”, “integer”) —> 12345

concat(string_1, string_2)

This function allows you to concatenate two strings together.

Example:

concat("hello", "world") —> helloworld | concat(”account_”,”id) —> account_id

 

dump(string)

This function simply inserts a string.

 

Example:

dump(”hello_world”) —> hello_world

 

joinStrings([”string_1”, “string_2”, … “string_n”] , ”delimiter”)

This function allows you to join multiple strings together using a specified delimiter.

 

Example:

joinStrings([“hello”, “world”], “ ”) —> hello world | joinStrings([“apple”, “banana”, “orange”], “-”) —> apple-banana-orange

 

splitString(”this,text,is,separated,by,commas” , “,”)

This function allows you to split a string into an array of substrings based on a specified delimiter.

Example:

splitString(“this,text,is,separated,by,commas”, “,”) —> [“this”, “text”, “is”, “separated”, “by”, “commas”]

 

mapToObject([object_1, object_2, … object_n], “pointer”)

This function takes a list of objects and maps them to an object with each key being the list of objects designated pointer.

 

Example:

Let’s say you have a list of objects, i.e. like this:

{
  "campaigns": [
    {
      "id": "abc",
      "spend": 2000
    },
    {
      "id": "def",
      "spend": 1785
    },
    {
      "id": "ezr",
      "spend": 7238
    },
    {
      "id": "ejo",
      "spend": 1230
    }
  ]
}

Now if instead of this list, you want an object where you can reference each of the campaigns by a key of their id, we can use the mapToObject function:

mapToObject(inputData(”/campaigns”),”id”)

This will result in:

{
  "campaigns": {
    "abc": {
      "id": "abc",
      "spend": 2000
    },
    "def": {
      "id": "def",
      "spend": 1785
    },
    "ezr": {
      "id": "ezr",
      "spend": 7238
    },
    "ejo": {
      "id": "ejo",
      "spend": 1230
    }
  }
}
 

Video Example

Did this answer your question?
😞
😐
🤩

Last updated on September 5, 2023