### String function examples (CONTAINS, CONCAT, LENGTH, TRIM) Source: https://knowledge.hubspot.com/data-management/build-and-activate-datasets-in-data-studio?hubs_content=knowledge.hubspot.com%2Fimport-and-export%2Funderstand-the-import-tool&hubs_content-cta=dataset-imports Examples of the CONTAINS, CONCAT, LENGTH, and TRIM string functions. Each example shows the function call and its returned value. Use these to understand the syntax and expected results for each string function. ```text CONTAINS("HubSpot", "Hub") = true CONTAINS("foo", "bar") = false CONTAINS([CONTACT.firstname], "Mike") ``` ```text CONCAT("Hub", "Spot") = "HubSpot" CONCAT([CONTACT.firstname], CONCAT(" ", [CONTACT.lastname])) ``` ```text LENGTH("HubSpot") = 7 LENGTH([FEEDBACK_SUBMISSION.hs_content]) ``` ```text TRIM(" Cats are great ") = "Cats are great" ``` -------------------------------- ### DATE_FROM_PARTS example Source: https://knowledge.hubspot.com/data-management/build-and-activate-datasets-in-data-studio?hubs_content=knowledge.hubspot.com%2Fdata-management%2Fcreate-and-use-summary-functions&hubs_content-cta=formula-field Creates a date value from year, month, and day parts. The example returns 2021-01-01. ```text DATE_FROM_PARTS(2021, 1, 1) ``` -------------------------------- ### divide operator alternative example Source: https://knowledge.hubspot.com/workflows/custom-formula-functions?hubs_content=knowledge.hubspot.com%2Fautomation%2Ftopics&hubs_content-cta=uiLinkDark Alternative syntax for division using the / operator. Example: 8/4 outputs 2. ```plaintext 8/4 ``` -------------------------------- ### add operator alternative example Source: https://knowledge.hubspot.com/workflows/custom-formula-functions?hubs_content=knowledge.hubspot.com%2Fautomation%2Ftopics&hubs_content-cta=uiLinkDark Alternative syntax for addition using the + operator. Example: 5+10 outputs 15. ```plaintext 5+10 ``` -------------------------------- ### concatenate function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=calculation-property Combines up to 100 strings into one value. Example: concatenate("Example", " Test") returns "Example Test". ```text concatenate("Example", " Test") ``` -------------------------------- ### min function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=calculation-property Gets the minimum of two numbers. Example: min(500, 250) returns 250. ```text min(500, 250) ``` -------------------------------- ### Numerical function examples (ABS, CEIL, DIV0, EXP, FLOOR, LN, LOG, POWER, SQRT, WIDTH_BUCKET) Source: https://knowledge.hubspot.com/data-management/build-and-activate-datasets-in-data-studio?hubs_content=knowledge.hubspot.com%2Fimport-and-export%2Funderstand-the-import-tool&hubs_content-cta=dataset-imports Examples of the ABS, CEIL, DIV0, EXP, FLOOR, LN, LOG, POWER, SQRT, and WIDTH_BUCKET functions. Each example shows the function call and its returned value. Use these to understand the syntax and expected results for each numerical function. ```text ABS(-10) = 10 ABS(10) = 10 ``` ```text CEIL(3.14) = 4 CEIL(EXP(1)) = 3 CEIL(LN([DEAL.amount])) ``` ```text DIV0(5, 2) = 2.5 DIV0(5, 0) = 0 DIV0([DEAL.amount], DATEDIFF("DAY", [DEAL.createdate], [DEAL.closedate])) ``` ```text EXP(1) = 2.718281828459045 EXP(0) = 1 ``` ```text FLOOR(3.14) = 3 CEIL(EXP(1)) = 2 FLOOR(LN([DEAL.amount])) ``` ```text LN(1) = 0 LN(EXP(1)) = 1 LN([DEAL.amount]) ``` ```text LOG(10, 1) = 0 LOG(10, 10) = 1 LOG(10, [DEAL.amount]) ``` ```text POWER(2, 10) = 1024 POWER(100, 0.5) = 10 POWER([DEAL.hs_arr], 2) ``` ```text SQRT(100) = 10 SQRT([DEAL.hs_arr]) ``` ```text WIDTH_BUCKET(25, 0, 100, 10) = 3 WIDTH_BUCKET(95, 0, 100, 10) = 10 WIDTH_BUCKET(-1000, 0, 100, 10) = 0 WIDTH_BUCKET(9999, 0, 100, 10) = 11 WIDTH_BUCKET([DEAL.amount], 0, 10000, 1000) ``` -------------------------------- ### max function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=calculation-property Gets the maximum of two numbers. Example: max(500,[properties.amount]) returns 500 if the amount value is less than 500. ```text max(500,[properties.amount]) ``` -------------------------------- ### last_updated function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=calculation-property Gets the date of when the token was last updated. Example: last_updated([properties.amount]) returns a timestamp string like "1672531200000". ```text last_updated([properties.amount]) ``` -------------------------------- ### WIDTH_BUCKET function examples Source: https://knowledge.hubspot.com/data-management/build-and-activate-datasets-in-data-studio?hubs_content=knowledge.hubspot.com%2Fget-started%2Fhubspot-glossary&hubs_content-cta=dataset Bins numerical values into equal-width buckets. Examples show WIDTH_BUCKET(25, 0, 100, 10) returning 3, WIDTH_BUCKET(95, 0, 100, 10) returning 10, WIDTH_BUCKET(-1000, 0, 100, 10) returning 0, WIDTH_BUCKET(9999, 0, 100, 10) returning 11, and a field usage. ```HubSpot Data Studio WIDTH_BUCKET(25, 0, 100, 10) = 3 ``` ```HubSpot Data Studio WIDTH_BUCKET(95, 0, 100, 10) = 10 ``` ```HubSpot Data Studio WIDTH_BUCKET(-1000, 0, 100, 10) = 0 ``` ```HubSpot Data Studio WIDTH_BUCKET(9999, 0, 100, 10) = 11 ``` ```HubSpot Data Studio WIDTH_BUCKET([DEAL.amount], 0, 10000, 1000) ``` -------------------------------- ### NOW example Source: https://knowledge.hubspot.com/data-management/build-and-activate-datasets-in-data-studio?hubs_content=knowledge.hubspot.com%2Fdata-management%2Fcreate-and-use-summary-functions&hubs_content-cta=formula-field Returns the current time based on the account's timezone. The example returns a datetime value such as 1633611966314. ```text NOW() ``` -------------------------------- ### pipeline_probability function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the probability of a pipeline stage. Returns a number. ```text pipeline_probability("newdeal") ``` -------------------------------- ### min function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the minimum of two numbers. Returns a number. ```text min(500, 250) = 250 ``` -------------------------------- ### max function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the maximum of two numbers. Returns a number. ```text max(500,[properties.amount]) = 500, if the amount value is less than 500. ``` -------------------------------- ### exchange_rate function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the most recent exchange rate. Returns a number. ```text exchange_rate("USD") ``` -------------------------------- ### month function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the numeric month of a given date. Returns a number. ```text month([properties.closedate]) ``` -------------------------------- ### if function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Sets up a conditional expression. The optional third argument must be the same type as the second argument; if omitted, the value is null when the condition is not met. ```text if([properties.amount] > 1000, "large", "small") ``` -------------------------------- ### currency_decimal_places function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the number of decimal places for a currency. Returns a number. ```text currency_decimal_places("USD") ``` -------------------------------- ### Customize post narration player colors with styles parameter Source: https://knowledge.hubspot.com/blog/use-the-post-narration-module?hubs_content=knowledge.hubspot.com%2Fai%2Ftopics&hubs_content-cta=uiLinkDark Add the styles parameter to change the player's colors. This example sets custom background, text, and hover colors. ```hubl {% module "narration" path="@hubspot/blog_audio", overrideable=False, styles={ groupColors: { override: 'custom', background: { color: '#0091ae' }, text: { color: '#ffbcac' }, hover: { color: '#7fded2' }, }, } %} ``` -------------------------------- ### dated_exchange_rate function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the value of an exchange rate at a given time. Returns a number. ```text dated_exchange_rate("USD", [properties.closedate]) ``` -------------------------------- ### POWER function examples Source: https://knowledge.hubspot.com/data-management/build-and-activate-datasets-in-data-studio?hubs_content=knowledge.hubspot.com%2Fget-started%2Fhubspot-glossary&hubs_content-cta=dataset Raises a base value to a specified power. Examples show POWER(2, 10) returning 1024, POWER(100, 0.5) returning 10, and POWER([DEAL.hs_arr], 2) as a field usage. ```HubSpot Data Studio POWER(2, 10) = 1024 ``` ```HubSpot Data Studio POWER(100, 0.5) = 10 ``` ```HubSpot Data Studio POWER([DEAL.hs_arr], 2) ``` -------------------------------- ### last_updated function example Source: https://knowledge.hubspot.com/properties/create-calculation-properties?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fadd-and-edit-your-account-currencies&hubs_content-cta=custom-equation Gets the date of when the token was last updated. Returns a timestamp in milliseconds as a string. ```text last_updated([properties.amount]) = "1672531200000" ``` -------------------------------- ### LENGTH function examples Source: https://knowledge.hubspot.com/data-management/build-and-activate-datasets-in-data-studio?hubs_content=knowledge.hubspot.com%2Faccount-management%2Fexport-your-content-and-data&hubs_content-cta=export-a-dataset Computes the length of a string. The first example returns 7, and the second returns the length of the feedback submission content. ```text LENGTH("HubSpot") ``` ```text LENGTH([FEEDBACK_SUBMISSION.hs_content]) ``` -------------------------------- ### DMARC policy examples: neutral, strict, and quarantine Source: https://knowledge.hubspot.com/marketing-email/overview-of-email-authentication?hubs_content=knowledge.hubspot.com%2Fmarketing-email%2Femail-deliverability-best-practices&hubs_content-cta=spf-and-dkim-records Three example DMARC TXT record values. The neutral policy (p=none) is the bare minimum for DMARC to function and is useful for senders just starting with DMARC. The strict policy (p=reject) bounces emails that fail authentication and includes an rua address for aggregate reporting. The quarantine policy (p=quarantine; pct=25) applies the policy to 25% of failing emails and includes an ruf address for failure reporting. ```text v=DMARC1; p=none; ``` ```text v=DMARC1; p=reject; rua=mailto:reporting@example.com; ``` ```text v=DMARC1; p=quarantine; pct=25; ruf=mailto:reporting@example.com; ```