Types Casting in SimpleMetric expression

Is it possible to do any sort of casting in SimpleMetric definitions?

I’ve a FixedAsset and Facility, my original metric is defined on Facility and use specific fields attached to Facility.
I want to run this metric on FixedAsset, I;m considering the use of an actionDecl metric and inside the javascript do the evalMetric with same inputs but on type Facility like this:

{
  "id" : "MySimpleMetric_FixedAsset",
  "name" : "MySimpleMetric",
  "srcType": "FixedAsset",
  "actionDecl": {
    "action": "asFacility"
  }
}

Then the javascript implementation on FixedAsset.js have something like:

function asFacility(obj, spec, metric) {
  return Facility.evalMetric({
    id: obj.id,
    expression: metric.name,
    start: spec.start,
    end: spec.end,
    interval: spec.interval
  });
}

This is definitley UGLY, was wondering if there is another option?

Facility is the child type of FixedAsset, if you want to use a metric that is on FixedAsset you should define the metric on FixedAsset, by the nature of inheritance that same metric will be available for Facility as well, unless overriden at the Facility level.

I’m not sure why you need to write an actionDecl metric on the FixedAsset layer. The above example doesn’t provide enough information to warrant that.

thanks @rohit.sureka I understand, but may case is on the other way around

my original metric is defined on Facility and use specific fields attached to Facility.

I want to run this metric from FixedAsset but as I know for sure that this object is a Facility, I want to run it as the later.