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

I'm having problems with the DataSource tag in the task I'm building.

 

Specifically the issue is with the defaultValue parameter. This documentation says I can use that parameter to assign a default Data source, however when I try it just doesn't work. Strangely the documentation says that passing in a blank string will force the user to choose a Data Source, and that does indeed work. Specifying one however just brings up the most recent Data Source.

 

My XML looks like this:

 

<DataSources>	
	<DataSource name="DATASOURCE" defaultValue="SASHELP.FISH" where="true">
	     <Roles>
	     </Roles>
	</DataSource>

 

Have I made a mistake or is this a known problem?

 

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
BrianGaines
SAS Employee

@jamesBFD,

 

Thanks for the information.  The defaultValue attribute/parameter was added to the DataSource and Role controls in SAS Studio 3.8.  As you noted, this attribute is included in the documentation for SAS Studio 3.8, but if you look at the documentation for SAS Studio 3.7 or SAS Studio 3.6, you see that it is not listed or available.  

 

If upgrading to SAS Studio 3.8 is not an option, then a workaround would be to create/compile your task, make the selections for the DataSource and Roles that you want to be the defaults, and then save the task as a .CTK file.  Then, when the .CTK task file is opened again (which can be done by right clicking on the .CTK file in the Server Files and Folders section and adding it to "My Tasks"), it will remember the selections you made for DataSource and Roles (and any other selections you made), so effectively you would have default values.

 

Does that make sense?  Will that work for you?

 

Thanks,

 

-Brian

View solution in original post

8 REPLIES 8
jamesBFD
Obsidian | Level 7
Also seems like defaultValue doesn't work for the Roles tag either? Certainly it isn't for me.
BrianGaines
SAS Employee

Hi @jamesBFD,

 

Could you please tell me which version of SAS Studio you are using?

 

Thanks,

 

-Brian

jamesBFD
Obsidian | Level 7

We're running 3.6 Enterprise Edition.

 

Thanks.

BrianGaines
SAS Employee

@jamesBFD,

 

Thanks for the information.  The defaultValue attribute/parameter was added to the DataSource and Role controls in SAS Studio 3.8.  As you noted, this attribute is included in the documentation for SAS Studio 3.8, but if you look at the documentation for SAS Studio 3.7 or SAS Studio 3.6, you see that it is not listed or available.  

 

If upgrading to SAS Studio 3.8 is not an option, then a workaround would be to create/compile your task, make the selections for the DataSource and Roles that you want to be the defaults, and then save the task as a .CTK file.  Then, when the .CTK task file is opened again (which can be done by right clicking on the .CTK file in the Server Files and Folders section and adding it to "My Tasks"), it will remember the selections you made for DataSource and Roles (and any other selections you made), so effectively you would have default values.

 

Does that make sense?  Will that work for you?

 

Thanks,

 

-Brian

jamesBFD
Obsidian | Level 7

@BrianGaines 

 

Thanks for the reply and solution.

 

That makes sense about why it's in that documentation and not working for me. I'd figured out the workaround by inspecting the <TemplateValues> tag code that was being generated when I saved CTK files. I'll look into upgrading Studio but will use the workaround for now.

BrianGaines
SAS Employee

No problem!  I'm glad to help and I'm glad that the workaround will work for you for the time being.

 

Best,

 

-Brian

snoopy369
Barite | Level 11
Sorry to necro this thread, but I was looking to do something similar today, and noticed that the documentation for 3.8 (linked in OP) no longer references defaultValue in data sources (and I have 3.8 and it doesn't work for me). @BrianGaines - do you know if this was removed from a later update to 3.8, and if so if it will come back at some point? The workaround you mention is okay, but ideally we'd have the ability to set it directly... thanks!
BrianGaines
SAS Employee

Hi @snoopy369,

 

No worries at all about bringing this thread back to life.   

 

I looked into this and, from what I can tell, the defaultValue attribute for a DataSource element actually was first introduced in SAS Studio 5.1 and not SAS Studio 3.8.  I believe its inclusion in the SAS Studio 3.8 documentation when James & I originally looked at it was a mistake, which is why it has since been removed from the documentation.   At the time, I just didn't actually verify that it worked in that version.

 

I did just try to use it in SAS Studio 3.8 and it also did not work for me, but it does work in SAS Studio 5.1.  So unfortunately, the workaround I mentioned previously is still the only way to deal with it in SAS Studio 3.8 that I am aware of.  

 

Hopefully this information is helpful!  Please post again if you have any additional task writing questions.  Speaking of which, this is a shameless plug, but for this year's SAS Global Forum I wrote a paper on custom task writing.  The focus of the paper is on writing custom tasks that generate CASL code, but I believe most of the tips and information in the paper are applicable to custom task writing in general.  I just wanted to bring it to your attention in case the paper is useful.

 

Best,

 

-Brian

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 8 replies
  • 1151 views
  • 1 like
  • 3 in conversation