Add attribute to dimensions or measures from model


(cristian) #1

Hi!
Is there a way to add an “attribute” to all dimensions or measures with a specific name/suffix/prefix?

I have like 20+ views and all have a “Timestamp” column that I want to hide. I don’t want to delete the columns/fields but I want to hide them. So, I would like add the attribute “Hidden:yes” to all dimensions within all views that have the name “Timestamp”. Is this possible to do from the “model” file?

Br
Cris


(Ian) #2

explore: view_name {
fields: [ALL_FIELDS*, -joined_view_name.unwanted_field]
}

Make a set of all unwanted fields as well, see here:


(cristian) #3

Great! Thanks. This works for my use case. Just to know…what if I would like to add another “attribute” like “format_value_name: decimal_0” to all measures that have a name like “Amount” or add “Type:number” to all dimensions with name like “%ID%”
Not possible?


(Ian) #4

Yeh not possible (happy to be corrected if wrong), will have to just use the search function in dev UI


(cristian) #5

Ok thanks!


#6

Cristian, FWIW, in these cases I clone the git repository and do these kinds of changes from the Unix command line or using a more powerful editor, then I check the changes back into git and push them to the main repository where Looker sees them.