Show metadata in a table

I have attached some metadata to some of my requirements, such as review state and approval status, as well as a source requirement identifier. I’d like to be able to pull these attributes into my table views. Is that possible?

metadata def RequirementMetadata {
  attribute reviewState : ReviewStateKind default = ReviewStateKind::Draft;
  attribute approvalStatus : ApprovalStatusKind default = ApprovalStatusKind::Draft;
  attribute sourceRequirementId : String [0..1];
}

@RequirementMetadata {
  approvalStatus = ApprovalStatusKind::Rejected;
}
requirement <'1.1'> RejectedRequirement {
  doc /* This is a rejected requirement. */
}
requirement <'1.2'> DraftRequirement {
  doc /* This is a draft requirement. */
}
@RequirementMetadata {
  approvalStatus = ApprovalStatusKind::Approved;
}
requirement <'1.3'> ApprovedRequirement {
  doc /* This is an approved requirement. */
}

Is there a way to do this?

Hello Jonathan,

Currently showing attributes of a metadata is not supported. It is planned as a future feature, but you should know two things about metadata tags:

  1. In your example you are using the @tag usage. It needs to be owned by the element you are trying to tag (as apposed to a #prefix metadata usage):
requirement def MyRequirement {
    @myTag{...}
}
  1. Metatags (both @tag and #prefix types) are not inherited along the tagged feature:
requirement def BaseRequirement {
    attribute myAttr { @myTag }
}
requirement def MyRequirement :> BaseRequirement {
    attribute :>> myAttr = 10; // this element is not tagged
}

Good to know. I’ll be patient. :slight_smile: Thanks for the help!

And thanks for the tip - I’ve seen examples with the @tag before the element and always thought that felt weird, so I’m glad I’m not up in the night!