<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Retrieving metadata objects gives no values in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885425#M26956</link>
    <description>&lt;P&gt;&amp;nbsp;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did what you asked for and here are the results:&lt;/P&gt;
&lt;P&gt;1. There is no&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;"No persons available"&lt;/EM&gt; note in the log file&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. I added this &lt;EM&gt;grpassn&lt;/EM&gt; handling but there are no errors, so it looks that values -3,-4 and grater than 0 are correct.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So my understanding is that the code finds metadata objects, but for some reasons it is not fetching it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In the log file I have only note that there are no observations.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: The data set WORK.GROUPMEMPERSONS_INF has 0 observations and 13 variables.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I know it is very hard to investigate, but maybe you have any other hints? Do you think it might be related to server configuration/encoding?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Thanks,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Filip&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2023 11:24:12 GMT</pubDate>
    <dc:creator>filippo_kow</dc:creator>
    <dc:date>2023-07-19T11:24:12Z</dc:date>
    <item>
      <title>Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885269#M26947</link>
      <description>&lt;P&gt;&amp;nbsp;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question regarding retrieving objects from metadata using 4GL code. I have quite simple code to get some metadata information, something like below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data groupmempersons_inf;
            length uri name dispname group groupuri $256 id MDUpdate $20;
            n=1;
            call missing (uri, name, dispname, group, groupuri, id, MDUpdate);
            nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
            /*nobj2=metadata_getnobj("omsobj:Machine?@Id contains '.'",n,uri);*/
            if nobj=0 then put 'No persons available.';
            else do 
                while (nobj &amp;gt; 0);
                    rc=metadata_getattr(uri, "Name", Name);
                    rc=metadata_getattr(uri, "DisplayName", DispName);
                    a=1;
                    grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);
                    if grpassn in (-3,-4) then do;
                        group="No groups";
                        output;
                    end;
                       else do 
                        while (grpassn &amp;gt; 0);
                            rc2=metadata_getattr(groupuri, "Name", group);
                            rc=metadata_getattr(groupuri, "MetadataUpdated", MDUpdate);
                            a+1;
                            output;
                            grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);
                        end;
                n+1;
                nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
            end;
    run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am running this code on a couple of servers (on Windows machines - SAS version is 9.4M7, OS is WX64_SV). For some servers it works fine (it returns necessary info), but for one server it returns null dataset (while it should return some records). I think there is something in the configuration that need to be changed. I know that this is very high-level description, but maybe anyone have some idea why it doesn't return any values on one particular server?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thanks in advance!&lt;BR /&gt;&amp;nbsp;Filip&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 13:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885269#M26947</guid>
      <dc:creator>filippo_kow</dc:creator>
      <dc:date>2023-07-18T13:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885273#M26948</link>
      <description>&lt;P&gt;When you get&amp;nbsp; a null dataset, do you get a note in your log "No persons available"?&amp;nbsp; If so, then the issue is this line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If not, I wonder if your code is covering all possible values for grpassn. It looks like it's assuming the values will always be -3, -4, or greater than 0.&amp;nbsp; After you calculate grpassn, you could add an assertion to check that assumption:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if NOT ( (grpassn IN (-3,-4)) or (grpassn&amp;gt;0) ) then put "ERROR: unhandled value " grpassn= ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 14:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885273#M26948</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-07-18T14:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885277#M26949</link>
      <description>&lt;P&gt;&amp;nbsp;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the info.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will check it, but one more thing - the code was working some time ago on this machine. I think admins changed something in the configuration and after that it doesn't work properly. So I am assuming it is related to some configuration, but of course I will check your suggestion.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 14:24:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885277#M26949</guid>
      <dc:creator>filippo_kow</dc:creator>
      <dc:date>2023-07-18T14:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885425#M26956</link>
      <description>&lt;P&gt;&amp;nbsp;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did what you asked for and here are the results:&lt;/P&gt;
&lt;P&gt;1. There is no&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;"No persons available"&lt;/EM&gt; note in the log file&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. I added this &lt;EM&gt;grpassn&lt;/EM&gt; handling but there are no errors, so it looks that values -3,-4 and grater than 0 are correct.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So my understanding is that the code finds metadata objects, but for some reasons it is not fetching it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In the log file I have only note that there are no observations.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: The data set WORK.GROUPMEMPERSONS_INF has 0 observations and 13 variables.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I know it is very hard to investigate, but maybe you have any other hints? Do you think it might be related to server configuration/encoding?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Thanks,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Filip&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 11:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885425#M26956</guid>
      <dc:creator>filippo_kow</dc:creator>
      <dc:date>2023-07-19T11:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885431#M26958</link>
      <description>&lt;P&gt;&amp;nbsp;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just noticed one more thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am connecting to metadata using the following options:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options metaserver="&amp;lt;server&amp;gt;"
metaport=8561
metauser="&amp;lt;user&amp;gt;"
metapass="&amp;lt;password&amp;gt;"
metarepository="Foundation";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Previously I was using user with full privileges, but when I changed the user to different, I can see some records - but unfortunately not all that are in metadata. Do you think it might be connected to some privileges or so?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, as I mentioned at the beginning I am running the same code with the same options of different servers and I have problem only with one of them.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 11:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885431#M26958</guid>
      <dc:creator>filippo_kow</dc:creator>
      <dc:date>2023-07-19T11:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885432#M26959</link>
      <description>&lt;P&gt;Hi, it's definitely possible the problem relates to permissions of the user that runs the code, because that user would need the permissions to read the metadata.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would focus on debugging the DATA step first.&amp;nbsp; Since you're getting a 0 obs dataset, that suggests that the code never enters the WHILE loop.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest after this line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if nobj=0 then put 'No persons available.';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;add a line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;else if nobj &amp;lt; 0 then put "ERROR: metadata_getnobj returned an unhandled value " nobj= ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;With the code as written, it looks like if metadata_getnobj returns a negative number (or a null), then you would get 0 obs in the output dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, I would focus on understanding the DATA step first.&amp;nbsp; Then once you know which metadata call isn't working like you want, you can dive into the world of metadata permissions to try and figure out why it's not working.&amp;nbsp; At that point, you might want to call your admin.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 12:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885432#M26959</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-07-19T12:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885442#M26960</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;for your reply,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are right - when I added this line and try to run the code from 'admin' account I have an error:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: metadata_getnobj returned an unhandled value nobj=-4&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And when I use my own user I have some records returned (unfortunately not all of them).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, I am just wondering why my personal user can read only some metadata (only few persons) and not all of them... Maybe you have some idea?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 12:34:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885442#M26960</guid>
      <dc:creator>filippo_kow</dc:creator>
      <dc:date>2023-07-19T12:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885447#M26963</link>
      <description>&lt;P&gt;Sorry, I understand the DATA step better than I understand metadata permissions. : ) At least now you know the cause of the problem is the first call to METADATA_GETNOBJ().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know there are lots of rules for metadata permissions.&amp;nbsp; I suppose it's possible that users could be defined in different metadata folders (or some other metadata 'context') and your account might not have metadata permission to see them all.&amp;nbsp; You could try opening up SAS Management Console to see if you can see the users there, and if what you see in SMC matches with what you get from this step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you might want to ask your admin to explain how metadata permissions might be effecting which users you can see.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 13:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885447#M26963</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-07-19T13:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885450#M26964</link>
      <description>&lt;P&gt;&amp;nbsp;Hi again&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, I fully understand &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I really appreciate your help, it was really nice to investigate the problem with MATADATA_GETNOBJ().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again &amp;amp; have a nice rest of the day! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 13:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885450#M26964</guid>
      <dc:creator>filippo_kow</dc:creator>
      <dc:date>2023-07-19T13:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885453#M26965</link>
      <description>&lt;P&gt;You have a nice day too! There are plenty of metadata knowledgeable folks in this community.&amp;nbsp; So hopefully someone else will jump in&amp;nbsp; with more answers.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 13:51:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885453#M26965</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-07-19T13:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving metadata objects gives no values</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885458#M26966</link>
      <description>A -4 from metadata_getnobj means that the "n" value is outside of the range, so for example if there are 2 users and you ask for user #3. So in this case it sounds like you're asking for user #1 and it's saying there are 0 users.&lt;BR /&gt;&lt;BR /&gt;This probably means your admin user is no longer defined in Metadata, so is being treated as PUBLIC, and does not have permission to see any user.&lt;BR /&gt;&lt;BR /&gt;As far as why your user ID only has permission to see certain users...are you sure that the other users haven't just been removed (perhaps like your admin user)? If you log in to SAS Management Console as your admin user do you see all the users there?</description>
      <pubDate>Wed, 19 Jul 2023 14:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Retrieving-metadata-objects-gives-no-values/m-p/885458#M26966</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2023-07-19T14:03:45Z</dc:date>
    </item>
  </channel>
</rss>

