<?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: sas data viewer custom task format issue in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/246270#M17485</link>
    <description>&lt;P&gt;Hi, Chris,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll read&amp;nbsp;sas.chm and try the FormatService later.&lt;/P&gt;
&lt;P&gt;For now, the SAS Formats=_ALL_ is good for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really appreciate&amp;nbsp;your help.&lt;/P&gt;
&lt;P&gt;Shen.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2016 02:31:11 GMT</pubDate>
    <dc:creator>ShenQicheng</dc:creator>
    <dc:date>2016-01-27T02:31:11Z</dc:date>
    <item>
      <title>sas data viewer custom task format issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/244855#M17424</link>
      <description>&lt;P&gt;I'm making my owner sas data viewer in a custom task(C#), and&amp;nbsp;the format need&amp;nbsp;to be applied.&lt;/P&gt;
&lt;P&gt;I refered to "SAS® 9.4 Providers for OLE DB Cookbook" and "&lt;A title="Sample 26145: Visual Studio 2005 Visual Basic Code Snippets" href="http://support.sas.com/kb/26/145.html#ADODB.VB.snippet" target="_self"&gt;Sample &lt;I&gt;26145: &lt;/I&gt;Visual Studio 2005 Visual Basic Code Snippets&lt;/A&gt;".&lt;/P&gt;
&lt;P&gt;Here is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;            var adoConnection = new ADODB.Connection();
            var adoRecordset = new ADODB.Recordset();
            var adoCommand = new ADODB.Command();

            var server = new SasServer(Consumer.AssignedServer);
            var connectString = "provider=SAS.IOMProvider.1; SAS Workspace ID={0}";
            adoConnection.Open(string.Format(connectString, server.GetWorkspaceIdentifier()), "", "", 0);
            adoCommand.ActiveConnection = adoConnection;
            adoCommand.CommandText = "select * from sashelp.class";
            adoCommand.CommandType = ADODB.CommandTypeEnum.adCmdText;
            adoCommand.Properties["SAS Formats"].Value = "_ALL_";
            //adoRecordset.Properties["SAS Formats"].Value = "_ALL_";
            adoRecordset.Open(adoCommand, System.Reflection.Missing.Value, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, 1);

            //Fill an ADO.NET DataSet using the ADODB Recordset
            var adapter = new OleDbDataAdapter();
            var dataTable = new DataTable();
            var count = adapter.Fill(dataTable, adoRecordset);

            sasDataGridView1.DataSource = dataTable.DefaultView;

            adoRecordset.Close();
            Marshal.ReleaseComObject(adoRecordset);
            adoConnection.Close();
            Marshal.ReleaseComObject(adoConnection);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it doesn't work. The DataGridView shows nothing.&amp;nbsp; If I change sashelp.class to sashelp.cars, I got a "At least one of the IDs values (element 2 which is -1) is invalid." exception.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I missing something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shen&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 02:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/244855#M17424</guid>
      <dc:creator>ShenQicheng</dc:creator>
      <dc:date>2016-01-21T02:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: sas data viewer custom task format issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/244862#M17425</link>
      <description>&lt;P&gt;Is this useful at all?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/FriedEgg/55ec275ae1e1c8fcbe6a" target="_blank"&gt;https://gist.github.com/FriedEgg/55ec275ae1e1c8fcbe6a&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 03:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/244862#M17425</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-21T03:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: sas data viewer custom task format issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/244867#M17426</link>
      <description>&lt;P&gt;Thanks, Reeza.&lt;/P&gt;
&lt;P&gt;I haven't tried the power shell version, though I do refered it and it helped me on implementing in c#, because I want to find a solution&amp;nbsp;on&amp;nbsp;c# developing.&lt;/P&gt;
&lt;P&gt;(I know that Chris posted a similar blog at &lt;A href="http://blogs.sas.com/content/sasdummy/2012/04/12/build-your-own-sas-data-set-viewer-using-powershell/" target="_blank"&gt;Build your own SAS data set viewer using PowerShell&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, I will&amp;nbsp;try the power shell&amp;nbsp;sample.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 05:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/244867#M17426</guid>
      <dc:creator>ShenQicheng</dc:creator>
      <dc:date>2016-01-21T05:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: sas data viewer custom task format issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/245164#M17427</link>
      <description>&lt;P&gt;I included a simple data set viewer in this example:&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="http://blogs.sas.com/content/sasdummy/2013/06/09/sas-client-with-microsoft-dot-net/" target="_self"&gt;Build your own SAS client app with Microsoft .NET&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Here's a screenshot:&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;IMG src="https://github.com/cjdinger/SasHarness/raw/master/datagrid.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If building a custom task, you might also look at &lt;A href="https://github.com/cjdinger/SasDataExample" target="_self"&gt;this SasDataExample&lt;/A&gt;.&amp;nbsp; It's described in &lt;A href="http://blogs.sas.com/content/sasdummy/2012/11/18/sas-data-classes-for-custom-tasks/" target="_self"&gt;Object-oriented access to SAS data in a custom task&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 13:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/245164#M17427</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-01-21T13:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: sas data viewer custom task format issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/246055#M17467</link>
      <description>&lt;P&gt;Thanks, Chris.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have learned the SasDataExample custom task sample before, but missed the "Apply Format" textbox.&lt;/P&gt;
&lt;P&gt;But this approach uses SAS.Tasks.Toolkit.Helpers.TaskDataHelpers.GetDistinctValues to get formatted values of a *single* column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I compared the working powershell version with my .NET program on ADODB usage and found that "SAS Formats=_ALL_" recordset property only works when ADODB.CommandTypeEnum.adCmdTableDirect is set, that means if I want to filter the table, I have to create a filtered data in work library and then&amp;nbsp;fetch data from&amp;nbsp;that work table. Am I right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 07:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/246055#M17467</guid>
      <dc:creator>ShenQicheng</dc:creator>
      <dc:date>2016-01-26T07:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: sas data viewer custom task format issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/246080#M17475</link>
      <description>&lt;P&gt;You might be correct about that, when using the OLE DB method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a handle to the SAS Workspace, you can use the Utilities interface to get a FormatService handle, and use the FormatService to apply formatting to values for you. &amp;nbsp;I'll warn you though: the methods are a little onerous to navigate. &amp;nbsp;You'll find them documented in the sas.chm file within your Integration Technologies client installation directory.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 12:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/246080#M17475</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-01-26T12:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: sas data viewer custom task format issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/246270#M17485</link>
      <description>&lt;P&gt;Hi, Chris,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll read&amp;nbsp;sas.chm and try the FormatService later.&lt;/P&gt;
&lt;P&gt;For now, the SAS Formats=_ALL_ is good for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really appreciate&amp;nbsp;your help.&lt;/P&gt;
&lt;P&gt;Shen.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 02:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sas-data-viewer-custom-task-format-issue/m-p/246270#M17485</guid>
      <dc:creator>ShenQicheng</dc:creator>
      <dc:date>2016-01-27T02:31:11Z</dc:date>
    </item>
  </channel>
</rss>

