Desktop productivity for business analysts and programmers

How to automatically open up the output dataset when a custom task is done running

Accepted Solution Solved
Reply
Regular Contributor
Posts: 241
Accepted Solution

How to automatically open up the output dataset when a custom task is done running

I am a novice trying to write a custom task for eg 4.3 using vs2010 on 32bit windows 7 running sas 9.3 (ts1m0) locally. My custom task is very similar to the "Calculate Lag" task, whose source is available here. I noticed that with the Calculate Lag task, the output dataset opens up when the task is done running. How one can do that? My task is similar in that it takes one input dataset and writes out an output dataset in WORK library. The task works fine -- the output dataset is created correctly. But it is not opened automatically. My main class overrides  both OutputDataCount and OutputDataDescriptorList properties, as shown below. Am I doing this correctly? If so, then what else should I do? Thanks!

public override int OutputDataCount
{
     get { return 1; }
}

public override List<ISASTaskDataDescriptor> OutputDataDescriptorList
{
     get
     {
          var server = Consumer.AssignedServer;
          var lib = "WORK";
          var mem = OutName();
          var lbl = string.Empty;
          var desc = SASTaskDataDescriptor.CreateLibrefDataDescriptor(server, lib, mem, lbl);
          var descs = new List<ISASTaskDataDescriptor>();    
          descs.Add(desc);

          return descs;
     }
}

public override ShowResult Show(IWin32Window Owner)
{
     Form dlg = new Form(this.Consumer);
     dlg.settings = settings;
     if (DialogResult.OK == dlg.ShowDialog(Owner))
     {
          settings = dlg.settings;
          return ShowResult.RunNow;
     }
     else
          return ShowResult.Canceled;
}


Accepted Solutions
Solution
‎05-10-2012 09:00 AM
Community Manager
Posts: 2,692

Re: How to automatically open up the output dataset when a custom task is done running

This looks like the correct code - just make sure that the OutName() routine returns the member name that is in fact generated by your code.  They must match.

You could try returning (-1) from the OutputDataCount, which tells EG to add *all* output data sets that are detected as created/modified as a result of your task.

Chris

View solution in original post


All Replies
Solution
‎05-10-2012 09:00 AM
Community Manager
Posts: 2,692

Re: How to automatically open up the output dataset when a custom task is done running

This looks like the correct code - just make sure that the OutName() routine returns the member name that is in fact generated by your code.  They must match.

You could try returning (-1) from the OutputDataCount, which tells EG to add *all* output data sets that are detected as created/modified as a result of your task.

Chris

Regular Contributor
Posts: 241

Re: How to automatically open up the output dataset when a custom task is done running

Hi, Chris:

You're right on. The OutName() function was returning a two word dataset name, e.g. WORK.TWO, instead of just the member name. Thanks a lot! Thank you also for the information on the -1 OutputDataCount value -- it is good to know.

Chang

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 268 views
  • 0 likes
  • 2 in conversation