Hi, I've found a code snippet online to get most of what I require in regards to Report.BI Metadata properties, however, the code to get ResponsibleParty information was answered elsewhere in a separate context, and I can't cobble together the two pieces of code. My issue is understanding how to utilise the metadata_getnasn command and whether it's right to do so within the getnobj loop. The query does return two usernames based on my ask, but, it can return those 1...2...even 7 times over. Same record, just many duplicates. Does anyone know (specifically regarding ResponsibleParties) how I obtain the creator/last modified names and dates, please? data MDIDs (drop=_: label="SAS VA Report List");
length id $17 _uri name _name _modified _created location _location createdby modifiedby name person $256;
length created modified 8;
format created modified datetime19.;
_nobj=1;
_n=1;
call missing(id, _uri, _uri2, name, role, person, createdby, modifiedby, _name, _modified, _created, _location);
do while(_n le _nobj);
_nobj=metadata_getnobj("omsobj:Transformation?@PublicType = 'Report.BI'",_n,_uri);
_rc=metadata_getattr(_uri,"Id",id);
_rc=metadata_getattr(_uri,"Name",_name);
_rc=metadata_getattr(_uri,"MetadataCreated",_created);
_rc=metadata_getattr(_uri,"MetadataUpdated",_modified);
created=input(_created,anydtdtm.);
modified=input(_modified,anydtdtm.);
name=translate(translate(translate(translate(_name,"-","–"),"£","£"),"%","%"),"+","+");
/* Get creator / last modified. Doesn't work properly. */
passn=metadata_getnasn(_uri,"ResponsibleParties",1,Respuri);
_rc=metadata_getattr(Respuri, "Name", CreatedBy);
output;
passn=metadata_getnasn(_uri,"ResponsibleParties",2,Respuri);
_rc=metadata_getattr(Respuri, "Name", ModifiedBy);
output;
* Get folder object the current Report is in *;
_rc=metadata_getnasn(_uri,"Trees",1,_uri);
* Get folder name the current Report is in *;
_rc=metadata_getattr(_uri,"Name",location);
_tree=1;
* Loop up the folder hierarchy *;
do while (_tree>0);
* Get the parent folder object *;
_tree=metadata_getnasn(_uri,"ParentTree",1,_uri);
if _tree > 0 then do;
* If there was a parent folder, get the name *;
_rc=metadata_getattr(_uri,"Name",_location);
* Construct the path *;
location=catx('/',_location,location);
end;
end; * Folder Hierachy *;
location = '/'||location;
output;
_n=_n+1;
end;
run;
... View more