0

I trying to create custom task in SAS Studio. I faced with problem, that i can't use variables of <DataSource> or <Option> in XML attributes or in tagged texts.

I need to programm task, that creates a new dataset in predefined library. Name of the dataset may be the same or custom. Here is an example of code:

<?xml version="1.0" encoding="utf-8"?>
<Task schemaVersion="5.0" runNLS="never">
    <Registration>
        <Name>Sample Task</Name>
        <Description>Demonstrates the Common Task Model functionality.</Description>
        <GUID>C6AC34BD-D14A-4CF5-BF2F-A110711BF819</GUID>
        <Procedures>PRINT</Procedures>
        <Version>3.5</Version>
        <Links>
            <Link href="http://www.sas.com">SAS Home page</Link>
        </Links>
    </Registration>
    <Metadata>
        <DataSources>
            <DataSource name="DATASOURCE">
        </DataSource>
        </DataSources>
        <Options>
            <Option name="DATATAB" inputType="string">DATA</Option>
            <Option name="DATAGROUP" inputType="string">DATA</Option>
            <Option name="ROLESGROUP" inputType="string">ROLES</Option>
            <Option name="OPTIONSTAB" inputType="string">OPTIONS</Option>
            <Option name="GROUP" inputType="string">GROUPS</Option>
            <Option name="labelRADIO" inputType="string">Choose name</Option>
            <Option name="nameRadioDefault" variable="radioNameChoice" defaultValue="1" 
                    inputType="radio">$DATASOURCE.getTable()</Option>
            <Option name="nameRadioAlter" variable="radioNameChoice" 
                    inputType="radio">Enter alter name:</Option>
            <Option name="textTableName" defaultValue="" inputType="inputtext" 
                    required="true"
                    indent="1"
                    promptMessage="Enter new table name"
                    missingMessage="Missing text."></Option>
        </Options>
    </Metadata>
    <UI>
        <Container option="DATATAB">
                <DataItem data="DATASOURCE"/>
                <OptionItem option="labelRADIO"/>
                <OptionItem option="nameRadioDefault"/>
                <OptionItem option="nameRadioAlter"/>
                <OptionItem option="textTableName"/>
        </Container>
    </UI>
    <Dependencies>
        <Dependency condition="$radioNameChoice == 'nameRadioDefault'">
            <Target action="disable" conditionResult="true" option="textTableName"/>
        </Dependency>
        <Dependency condition="$radioNameChoice == 'nameRadioAlter'">
            <Target action="enable" conditionResult="true" option="textTableName"/>
        </Dependency>
    </Dependencies>
    <CodeTemplate>
        <![CDATA[
%put DATASET=$DATASOURCE;
%put SASLIBRARY=$DATASOURCE.getLibrary();
%put SASTABLE=$DATASOURCE.getTable(); 
        ]]>
    </CodeTemplate>
</Task>

As result, I have this simple custom task:

enter image description here

In code area, I see reaction by changing options:

enter image description here

enter image description here

Choose another:

enter image description here

enter image description here

But unfortunately, name of radiobutton don't changing. I tried to wrap VTL variable $DATASOURCE.getTable() by <![CDATA[...]]> , but it's not working.

In SAS Studio 3.5: Developer's Guide to Writing Custom Tasks

So my question is it possible to use VTL variables in that way? And if possible, how to realize it?

In SAS Studio 3.5: Developer's Guide to Writing Custom Tasks I can't find answer, but SAS Studio has a complex task as "Join", that has graphical Data Source. And it's not described in Guide. This led to the idea - not all capabilities describe in Guide. If I wrong, please correct Me. Thanks.

Thanks.

Sanek Zhitnik
  • 716
  • 1
  • 10
  • 25
  • 1
    @Parfait , no. I working with XML that define structure of new task in SAS Studio: is there element to choose dataset, or elements that set some other options as path to dataset or name. To create new task, the xml must be parsed, and then you get GUI of task. – Sanek Zhitnik Sep 09 '16 at 11:49
  • @Parfait I'm not sure that SCL/frame. I mean task in [SAS Studio](https://support.sas.com/software/products/sasstudio/). I will include source file, thanks. – Sanek Zhitnik Sep 09 '16 at 14:02
  • Look at the examples. There are already built in tools for letting the user select the table. I don't see the need to use a variable reference in defining your options. – Tom Sep 09 '16 at 20:50

0 Answers0