Main Content

updateDocUri

Class: slreq.LinkSet
Package: slreq

Update link destination for direct links

Syntax

count = updateDocUri(myLinkSet,oldID,newID)

Description

count = updateDocUri(myLinkSet,oldID,newID) updates the link destinations for the direct links in the link set specified by myLinkSet from the external document specified by the resource identifier (such as a file path or IBM® Rational® DOORS® module ID) oldID to the external document specified by the resource identifier newID. The method returns the number of links updated.

Note

You might have to save the link set, close it, and reopen it for the changes to take effect.

Input Arguments

expand all

Link set, specified as an slreq.LinkSet object.

Resource identifier for the original external document, specified as a string scalar or character vector.

Resource identifier for the new external document to use as the link destinations, specified as a string scalar or character vector.

Output Arguments

expand all

Number of updated slreq.Link objects in the link set, returned as a character vector.

Examples

expand all

This example shows how to update the link destinations for direct links to the URI of a new document.

Open the Link to Requirements in Microsoft Word Documents example, which uses a model that has direct links to external documents.

openExample('slrequirements/LinkToRequirementsInMicrosoftWordDocumentsExample');

Open the slvnvdemo_fuelsys_officereq model. Find the associated link set.

open_system("slvnvdemo_fuelsys_officereq.slx")
myLinkSet = slreq.find("Type","LinkSet","Name","slvnvdemo_fuelsys_officereq");

Update Direct Link Destinations

Some of the links in myLinkSet point to slvnvdemo_FuelSys_DesignDescription.docx. Update the link destinations to point to slvnvdemo_FuelSys_DesignDescription_new.docx.

count = updateDocUri(myLinkSet,"slvnvdemo_FuelSys_DesignDescription.docx","slvnvdemo_FuelSys_DesignDescription_new.docx")
count = 8

Save the link set. Then close the link set and re-open it for the changes to take effect.

tf = save(myLinkSet)
tf = logical
   1

slreq.clear;
myLinkSet = slreq.load("slvnvdemo_fuelsys_officereq.slmx");

Tips

  • If you rename or move an external requirements document file, use updateSrcFileLocation to update the file name or path of the referenced requirements in the requirement set.

  • To update the external requirements document resource identifier for referenced requirements imported from non-file-based domains, use updateSrcArtifactUri.

Version History

Introduced in R2018a