Retrieving metric description


#1

I added description on all my metrics in seed data.
Because the doc says it is translated by name I get the name instead of the description when I do
SimpleMetric.fetch({include: “description”}).

How can I actually get the description?

Thanks


#2

You have to add Translation data in your seed directory:

id,locale,key,value
en.data.SimpleMetric.MyMetricName.description,en,data.SimpleMetric.MyMetricName.description,"Measures some data" 

Where the id is of the form
<locale id>.data.<type name>.<"translate by" field name value>.description

And key is of the form
data.<type name>.<"translate by" field name value>.description

For more information, see the Translation documentation article (/documentation/topic/Translation#section:1.2)


#3

Is it MyMetricName or MyMetricId?

From the documentation it looks like I have to put the id of an object…


#4

It should be MyMetricName.


#5

It worked for simple metrics but not for compound metrics. I followed the same conventions. Did I miss anything?


#6

@romain.juban Does the compound metric have different metric name and metric id? In general we set them same.


#7

Yes They are the same. Do you have a working example I can check?