<?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: Help (TaskSelectedDataControl error) in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-TaskSelectedDataControl-error/m-p/197245#M14914</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for you answer, but it still not make my problem solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the incomplete sample code I posted.&lt;/P&gt;&lt;P&gt;Yes, I do confirm the &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;selectedDatasets variable being not null before doing anything further in my real code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;The reason that I cast the return type of ShowInputDataSelector methods to ISASTaskData2[] is for convenience that I will need this later:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;1. Get columns of the dataset by using GetColumns() methods of SasData class whose constructor needs a SASTaskData2 type parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;2. Set the TaskData property of TaskSelectedDataControl.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;I can change both of them to do cast right at it is being used , if it helps, just like the &lt;SPAN style="color: black;"&gt;SASPress.Examples.RunningTotals&lt;/SPAN&gt; sample shows.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;My prolem is, I call Consumer.ShowInputDataSelector to select a data and set it to TaskSelectedDataControl's TaskData property, then in the TaskSelectedDataControl I do nothing but click the OK button, the error message box pops up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;This only occures when I create the task on a &lt;STRONG&gt;new&lt;/STRONG&gt; project.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Shen&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Mar 2015 03:48:58 GMT</pubDate>
    <dc:creator>ShenQicheng</dc:creator>
    <dc:date>2015-03-12T03:48:58Z</dc:date>
    <item>
      <title>Help (TaskSelectedDataControl error)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-TaskSelectedDataControl-error/m-p/197243#M14912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am creating an EG custom task with more than one input data and [InputRequired] attribute being set to [InputResourceType.None].&lt;/P&gt;&lt;P&gt;In task’s [Show] override method I use the [Consumer.ShowInputDataSelector] to require all input data before showing task form.&lt;/P&gt;&lt;P&gt;There is a [TaskSelectedDataControl] control on the task form that user can use it to filter the dataset.&lt;/P&gt;&lt;P&gt;Here is the problem: &lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;Create a new task on a new EG project.&lt;/LI&gt;&lt;LI&gt;Select a dataset for input data in the pop-up dialog.&lt;/LI&gt;&lt;LI&gt;Click the [Edit] button of [TaskSelectedDataControl] control on the task form.&lt;/LI&gt;&lt;LI&gt;Click the [OK] button of the filter setting dialog.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;An error occurred say “Can not select a data source. Reason: Index out of range.”.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;If I ignore the above error and save the task, (the selected input data comes out to the project flow at this time) and open it again and do same processes as above, no error occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Is there any way that I can resolve this problem?&lt;/P&gt;&lt;P&gt;Is there any must thing that I missed after calling ShowInputDataSelector?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;You can reproduce this by making a few changes on &lt;SPAN style="color: black;"&gt;SASPress.Examples.RunningTotals:&lt;/SPAN&gt; &lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;Task attribute: [InputRequired(InputResourceType.None)]&lt;/LI&gt;&lt;LI&gt;At beginning of public override ShowResult Show(System.Windows.Forms.IWin32Window Owner) insert following code&amp;nbsp;&amp;nbsp; &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var cookie = string.Empty; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var selectedDatasets = Consumer.ShowInputDataSelector(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; null, DataSelectionMode.ReadOnlySingleInput, ServerAccessMode.AnyServer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "", "SASHELP", string.Empty, ref cookie) as ISASTaskData2[]; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Consumer.ClearInputData();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Consumer.AddInputData(selectedDatasets[0]);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 07:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-TaskSelectedDataControl-error/m-p/197243#M14912</guid>
      <dc:creator>ShenQicheng</dc:creator>
      <dc:date>2015-03-09T07:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help (TaskSelectedDataControl error)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-TaskSelectedDataControl-error/m-p/197244#M14913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Be sure to check for &lt;STRONG&gt;null&lt;/STRONG&gt; on the &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;selectedDatasets variable before you try to reference it.&amp;nbsp; If you click Cancel on the data selector, the return will be &lt;STRONG&gt;null&lt;/STRONG&gt;. You should then call ClearInputData and AddInputData only if the &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;selectedDatasets != null.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, ShowInputDataSelector returns an array of ISASTaskData[], not ISASTaskData2[].&amp;nbsp; You should probably not try to cast this to ISASTaskData2&amp;nbsp;&amp;nbsp; The returned object in the array will support ISASTaskData &lt;STRONG&gt;and &lt;/STRONG&gt;ISASTaskData2, but the way the interfaces are designed, I would not cast those to other types unless you need the specific ISASTaskData2 methods/properties.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 21:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-TaskSelectedDataControl-error/m-p/197244#M14913</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2015-03-11T21:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help (TaskSelectedDataControl error)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-TaskSelectedDataControl-error/m-p/197245#M14914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for you answer, but it still not make my problem solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the incomplete sample code I posted.&lt;/P&gt;&lt;P&gt;Yes, I do confirm the &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;selectedDatasets variable being not null before doing anything further in my real code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;The reason that I cast the return type of ShowInputDataSelector methods to ISASTaskData2[] is for convenience that I will need this later:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;1. Get columns of the dataset by using GetColumns() methods of SasData class whose constructor needs a SASTaskData2 type parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;2. Set the TaskData property of TaskSelectedDataControl.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;I can change both of them to do cast right at it is being used , if it helps, just like the &lt;SPAN style="color: black;"&gt;SASPress.Examples.RunningTotals&lt;/SPAN&gt; sample shows.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;My prolem is, I call Consumer.ShowInputDataSelector to select a data and set it to TaskSelectedDataControl's TaskData property, then in the TaskSelectedDataControl I do nothing but click the OK button, the error message box pops up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;This only occures when I create the task on a &lt;STRONG&gt;new&lt;/STRONG&gt; project.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Shen&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 03:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-TaskSelectedDataControl-error/m-p/197245#M14914</guid>
      <dc:creator>ShenQicheng</dc:creator>
      <dc:date>2015-03-12T03:48:58Z</dc:date>
    </item>
  </channel>
</rss>

