Injecting extended view dimension in derived table sql doesn't work

Hi,

I built a future looking period control that has application in 4 different views. In the spirit of DRY, I built my lookml code in an independent view that I am extending into my 4 other views and I am using the sql_where declaration in my join to inject the proper clause.

Setting up the code just like table_a works well, but when I have a setup like table_b, the sql_always_where_inject reference won't work in the derived table declaration. I can't get the sql_always_where_inject to show up. 

 

 

## Explore File
explore: my_explore {
  join: table_a {
    sql_on: ${my_explore.id} = ${table_a.id} ;;
    type: inner
    relationship: one_to_many
    sql_where: ${table_a.sql_always_where_inject} ;;
  }
  join: table_b {
    sql_on: ${my_explore.id} = ${table_b.id} ;;
    type: inner
    relationship: one_to_many
  }
}

## view_a / table_a
include: "/future_period_controls.view"
view: advance_campsite_data {
  sql_table_name: schema.table_a ;;
  ##LookML here
  extends: [future_period_controls]
}

## view_b / table_b
include: "/future_period_controls.view"
view: table_b {
  derived_table{
    #Can't get the sql_always_where_inject to show up
    sql: select * from schema.table_b where ${table_b.sql_always_where_inject} ;;
  }
  ##LookML here
  extends: [future_period_controls]
}

## future_period_controls.view
view: future_period_controls {
  extension: required
  
  dimension: sql_always_where_inject {
    sql: --SQL GOES HERE ;;
  }
}

 

 

I tried referencing it in liquid or with the original view name `${future_period_controls.sql_always_where_inject}` and both didn't work. 

Is there a way to achieve what I'm trying to do or will I have to depart from a derived table (which I would very much like to avoid). 

Thank you!

0 1 144
1 REPLY 1
Top Labels in this Space
Top Solution Authors