BookmarkSubscribeRSS Feed

Custom Task Tuesday: My Favorite Mistakes, a Code Confession (& SGF Kickoff!)

Started ‎03-03-2020 by
Modified ‎04-08-2020 by
Views 3,449

medium.jpg1571079347403.png

Welcome back for another Custom Task Tuesday mini-series! For SAS Global Forum 2020 I have written a piper titled: SAS® Studio Custom Tasks: Tips and Tricks for the Adventurous Task AuthorThis paper focuses on advanced custom task topics that aren't normally covered introductory materials, such as optional task sections, multiple-task workflows, advanced velocity template language, and working with CAS tables.

 

I released blogs on custom task topics related to the material in the paper every Tuesday leading up to the release of the SGF proceedings.

 

To kick off the series, this Tuesday I started with my first code confession...

 

My Favorite Custom Task Mistakes

If you are a SAS programmer, you know the dreaded missing semicolon. The SAS Log provides useful targeted feedback, but it provides feedback on the kinds of errors most people make most often.  Those are not necessarily the mistakes you, yourself, make most often. If you have tried to build one of the tasks from my Communities series or one of your own, you know there is even less feedback from the task debugger.  Velocity can be written so many ways, it would be hard to capture every mistake anyone might make. 

 

However, after having built a ton tasks over the past three years, there are a few mistakes I find myself making over and over.  At the risk of personal embarrassment and for the good of the community, here is the list of mistakes I find I make most often and how I know how to find them.

 

1. Adding a control to the Metadata section, but forgetting to add it to the UI section

 

As we all know, when you want to add a new control (a drop down, checkbox, etc.) to your task, you have to add it to both the Metadata Section AND the UI Section. The Metadata Section is where you define all of the attributes/settings for your new control, but the UI section is what actually places the control in the interface. 

 

This is probably my most common mistake, but lucky this one is pretty easy to spot. Making this mistake will not result in any errors when trying to open the task, but it will still be obvious because your new control will not be there! If you add a new control, run your task, and then think to yourself "Where is that check box I just added??" - I would start with checking the UI section. 

 

2. Forgetting to access role selectors like arrays

 

This is another one that still trips me up from time to time. I will forget that I need to access the role selector like an array with a ".get()" or a "#foreach," and just put $VAR straight into my SAS code. Seen below:

codeee.PNG

You'll know you've made this mistake if you see [brackets] around your chosen variable in the code window. You won't get a Velocity error when opening the task, but you will get an error in the SAS log if you try to run the code.code confessison.PNG

 

 

3. Copy & pasting only one part of what you need from an example task

 

This mistake happened to me recently, and in an embarrassing fashion. @BrianGaines helped me catch myself on this and was nice enough not to laugh at me! I was working on a task for my SGF paper. Brian sent me an example that had a requirement that was similar to what I needed for my task. For the life of me, I couldn't figure out why the requirement worked in Brian's task and didn't work for me.

 

Check out this excerpt from our email conversation:code confeesion.png

I had copy & pasted the requirement from Brians task, but I didn't take have the outer/parent <Requirement> tags. This didn't cause a Velocity error when I opened my task, but I knew the requirement wasn't working as expected. Sometimes you just need an extra pair of eyes... Thanks Brian!

 

Have any favorite task mistakes of your own? Tweet them to me!

Twitter_bird_logo_2012.svg.pngUse the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your favorite (or least favorite) mistakes. Task authors, let's commiserate with each other!

Version history
Last update:
‎04-08-2020 09:37 AM
Updated by:
Contributors

SAS Innovate 2025: Register Now

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!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags