BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ajuvaba
Calcite | Level 5

Hi all,

I hope that somebody can help me to find a solution for my problem. I hope it is not complicated but somehow I'm just not able to solve it:

There are some Reports that are created with stored processes and stored on metaserver under Reports -> Special

We have created the permission-concept that gives some users possibility to open this Folder, others don't even see that it exists.

Now I would like to create a link from one Stored Process to those but show then (links) only if the user can see the Folder.

there are many ways to open directory, count files, check if the file can be opened etc. However, the problem is that all examples are made on windows (local) server. I have a unix server and I don't know where those files are...

I haven't found a way to check if a folder or a directory or a file inside it exists using only meta-path.

is there a way?

Thanks for sharing ideas.

1 ACCEPTED SOLUTION

Accepted Solutions
FalkoSchulz
SAS Employee

Hi,

I'm assuming you just want to scan a metadata folder to see whether or not it contains stored processes? The following example is more generic but creates a single table which lists all stored processes found in metadata (across all folders). You can adjust the code or simply filter for the folder you are after. As you mentioned the final list of reports is dependent on the permissions of the given user (if you are planning to run this as part of a Stored Process you don't need to have the meta* options):

options metaserver="localhost"
metaport=8561
metauser="myuser"
metapass="mypass"
metarepository="Foundation";

data reports;
length label $200 path $500 tmp $500;
    length uri $256 asnuri $256;
    nobj=1;
    n=1;

keep label path;
    do while(nobj >= 0);
        nobj=metadata_getnobj("omsobj:ClassifierMap?@Id contains '.' and @PublicType eq 'StoredProcess'",n,uri);
     rc=metadata_getattr(uri,"Name",label);
  rc=metadata_getnasn(uri,"Trees",1,asnuri);
  arc=metadata_getattr(asnuri,"Name",path);

  /* walk through all the trees on this ClassifierMap object. */
  rc = 1;
  do while(rc>0);
   rc=metadata_getnasn(asnuri,"ParentTree",1,asnuri);
         arc=metadata_getattr(asnuri,"Name",tmp);
   if (rc>0) then path = trim(tmp) || "/" || trim(path);
     end;

  /* building the stored process full qualified path*/
  path = "/" || trim(path) || "/" || trim(label) || "(StoredProcess)";
        n=n+1;
  output;
    end;
run;

View solution in original post

3 REPLIES 3
jakarman
Barite | Level 11

Reading your question it is a SAS-metadata question.

That has nothing to do with Windows or Unix Specifics although the word folder is used.

It is that more than one thing can share the same name. You are ajuvaba, is that name solely used for you?

I do not get the intention of your question, or what you ar trying to solve.

With normal usage the user only can select the thing he can see.

Some idea for reporting:

Do A export metadata from the path with the user having limitation (creating a package).

Use the log of that process as it generates a listing of all it could see.

You could build it all yourself on low-level interfaces. SAS(R) 9.4 Open Metadata Interface: Reference and Usage

or with datastep interface SAS(R) 9.4 Language Interfaces to Metadata . I would classify this as to diificult. 

---->-- ja karman --<-----
FalkoSchulz
SAS Employee

Hi,

I'm assuming you just want to scan a metadata folder to see whether or not it contains stored processes? The following example is more generic but creates a single table which lists all stored processes found in metadata (across all folders). You can adjust the code or simply filter for the folder you are after. As you mentioned the final list of reports is dependent on the permissions of the given user (if you are planning to run this as part of a Stored Process you don't need to have the meta* options):

options metaserver="localhost"
metaport=8561
metauser="myuser"
metapass="mypass"
metarepository="Foundation";

data reports;
length label $200 path $500 tmp $500;
    length uri $256 asnuri $256;
    nobj=1;
    n=1;

keep label path;
    do while(nobj >= 0);
        nobj=metadata_getnobj("omsobj:ClassifierMap?@Id contains '.' and @PublicType eq 'StoredProcess'",n,uri);
     rc=metadata_getattr(uri,"Name",label);
  rc=metadata_getnasn(uri,"Trees",1,asnuri);
  arc=metadata_getattr(asnuri,"Name",path);

  /* walk through all the trees on this ClassifierMap object. */
  rc = 1;
  do while(rc>0);
   rc=metadata_getnasn(asnuri,"ParentTree",1,asnuri);
         arc=metadata_getattr(asnuri,"Name",tmp);
   if (rc>0) then path = trim(tmp) || "/" || trim(path);
     end;

  /* building the stored process full qualified path*/
  path = "/" || trim(path) || "/" || trim(label) || "(StoredProcess)";
        n=n+1;
  output;
    end;
run;

ajuvaba
Calcite | Level 5

thank you very much for quick answers. the example code is exactly what I need. now I understand what I have to do - walk through the metadata. I already tried it and it gives me exactly what I need.

Fantastic.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2012 views
  • 1 like
  • 3 in conversation