AMQL Docs
Reusability

Reuse models but dynamically modify dimensions

This document describes how to use AML Extend to reuse a data model but modify its fields

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 }};;
	}
}

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