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.
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
We're running 3.6 Enterprise Edition.
Thanks.
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
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.
No problem! I'm glad to help and I'm glad that the workaround will work for you for the time being.
Best,
-Brian
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
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.