Skip to main content

Reuse models but dynamically modify dimensions

You can use AML Extend to reuse the same model but modify its dimensions.

Let's say that you have a product model that contains a description dimension, and you want to truncate this to the first 50 characters. You can use SQL to re-define the dimension definition in AML Extend like this:

Model product {
// Details of this dimension are omitted for brevity
dimension product_description {
// Other propreties are omitted for brevity
defnition: @sql {{ #SOURCE.product_description }};;
}
}

Model productWithShortDescription = product.extend({
dimension product_description {
definition: @sql left({{#SOURCE.product_description}}, 50);;
}
})


Let us know what you think about this document :)