Skip to content

Commit

Permalink
Merge pull request #46 from dwallace0723/nullif-get-url-param
Browse files Browse the repository at this point in the history
Have get url paramater macro return null when blank
  • Loading branch information
drewbanin authored Jan 11, 2018
2 parents 78b6fc2 + b752214 commit ee23c73
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions macros/web/get_url_parameter.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% macro get_url_parameter(field, url_parameter) %}
{% macro get_url_parameter(field, url_parameter) -%}

{% set formatted_url_parameter = "'" + url_parameter + "='" %}
{%- set formatted_url_parameter = "'" + url_parameter + "='" -%}

{{
dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), "'&'", 1)
}}
{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), "'&'", 1) -%}

{% endmacro %}
nullif({{ split }},'')

{%- endmacro %}

0 comments on commit ee23c73

Please sign in to comment.