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

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;
}

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
chang_y_chung_hotmail_com
Obsidian | Level 7

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

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 916 views
  • 0 likes
  • 2 in conversation