Answered my own question - command will keep existing selection as expected. My mistake was in having a slightly different name in the array of combobox options, so of course it was reset since the previous selection in my case was no longer an option.
updateAttribute in class: slreq.ReqSet Package: slreq resets Combobox for existing requirements.
1 次查看(过去 30 天)
显示 更早的评论
When using the updateAttribute in the slreq.reqset class, the command for updating a combobox attribute overwrites any existing choice for that attribute. The same does not happen for Edit or Checkbox types.
Any idea if this is a bug or I am calling it incorrectly? I would like to run this to keep my reqset attributes aligned across requirement sets, but it won't work if it resets my existing data each time.
This is an abbriviated version of my code:
function spec_update_attributes(spec)
%----------------------------------------------------------------------
% For spec name provided as input, update the requirement set object
% to have matching attributes as the standard set, as defined in this
% .m file. If a spec doesn't exist, this function will create a new
% requirement set file and assign it the defined set of standard
% attributes.
%----------------------------------------------------------------------
% Load spec, if it doesn't exist, create a new one.
try
rs = slreq.load(spec);
catch
rs = slreq.new(spec);
end
%----------------------------------------------------------------------
% Update attributes to new standard.
% If attributes don't exist, create them.
%-----Attibute-----
VMIDesc = "This check indicates if the requirement will be verified by Inspection.";
try
updateAttribute(rs,'VM Inspection','DefaultValue',false, 'Description', VMIDesc);
catch
addAttribute(rs,'VM Inspection','Checkbox','DefaultValue',false, 'Description', VMIDesc);
end
%-----Attibute-----
EffDesc = "Effectivity enum is used to denote which requirements " + ...
"apply to all missions or specific customer applications.";
EffList = {'Unset','All','Demo','Cust 1'};
try
updateAttribute(rs,'Effectivity','List', EffList , 'Description', EffDesc);
catch
addAttribute(rs,'Effectivity','Combobox','List', EffList, 'Description', EffDesc);
end
%-----Attibute-----
VEDesc = "Verification Expectations defines the planned verification process.";
try
updateAttribute(rs,'Verification Expectations', 'Description', VEDesc);
catch
addAttribute(rs,'Verification Expectations','Edit', 'Description', VEDesc);
end
end
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!