Expression Step

by Voodoo Editor
3 years ago
891 Views

Table of Contents


Expression Step Development Guide

VooDoo Studio has a rich infrastructure that includes many steps used during scenario development. These steps, which can be classified in various categories such as interface, system, e-mail, provide a fast, convenient and comfortable development environment.

However, sometimes a feature that is not available in the system may need to be used in processes or an existing feature needs to be customized. In this case, a step that is not available in VooDoo Studio can be developed and easily integrated into the VooDoo design interface and used by robots in processes. This ability is realized through the expression step.

When VooDoo Studio is opened, it reads the expression steps that can be used from a file in xml format. The steps added to this file can be used by accessing both the search features in each step explorer and the expression step. At this stage, what needs to be done to add a step to VooDoo is described below in order.

1. Description of Expression XML File

Expression steps are kept in expression.xml file under C:\Voodoo\Client\CodeBase\Code Snippet directory. Since new phrases downloaded from the Internet are overwritten in this file, it is possible to overwrite the additions made to this file later. Therefore, it is recommended to take a backup before and after making changes to this file.

2. Adding the Expression Group

The step to be added can belong to a new or existing group. If it belongs to a new group, the group must be added to the file first. For this, the data is added under the <ExpressionGroups> node in accordance with the following xml format.

<DataScenarioExpressionGroup>
    <Name></Name>
    <LabelTr></LabelTr>
    <LabelEng></LabelEng>
</DataScenarioExpressionGroup>  

The fields here have the following meaning.

Field Description
Name The name of the group. This name is then used when defining the expression to indicate its group.
LabelTr It is the Turkish description to be used when the group is displayed in the VooDoo Studio interface.
LabelEng It is the English description to be used when displaying the group in the VooDoo Studio interface.
3. Adding the Expression

It is added under the <ExpressionSnippets> node in accordance with the XML format given below.

<DataScenarioExpressionSnippet>
    <Name>...</Name>
    <GroupName>...</GroupName>
    <LabelTr>...</LabelTr>
    <LabelEng>...</LabelEng>
    <DevLanguageId>...</DevLanguageId>
    <LstParameters>
        <DataScenarioExpressionSnippetParameter>
            <Name>...</Name>
            <LabelTr>...</LabelTr>
            <LabelEng>...</LabelEng>
            <ControlType>...</ControlType>
            <BoundDataType>...</BoundDataType>
            <NameOfParametersToUpdateOnChange>...</NameOfParametersToUpdateOnChange>
        </DataScenarioExpressionSnippetParameter>
    </LstParameters>
    <UserCodeTemplate>...</UserCodeTemplate>
</DataScenarioExpressionSnippet>
3.1. Adding the Expression

The general information of the expression is the name of the expression, the name to show in the interface, etc. contains information such as

Field Description
Name Name of expression.
GroupName The “Name” property of the group to which the expression belongs.
LabelTr The name used in the Turkish interface. Since this name is used in searches and in the expression step, it should clearly express the action that the step will take. It’s like “copying a file”.
LabelEng The name of the expression used in the English interface.
DevLanguageId The programming language in which the expression was developed. It consists of predefined values.
CSharp : Used for C#.
3.2. Adding Parameters with Expression

If the expression uses parameters while executing <LstParameters> defined under the node. If more than one parameter is used, it is added one below the other.

Field Description
Name Name of Parameter
LabelTr The name of the parameter used in the Turkish interface. This name is displayed on the label next to the control to enter the parameter.
LabelEng The name of the parameter used in the English interface.
ControlType Control type to be used when entering the parameter. It consists of predefined values.

TextBox
DropDownList
SelectFileTextBox
SelectDirectoryTextBox
Password
BoundDataType Defines the data to be listed when a data-binding control type, such as a drop-down list, is selected in the ControlType field. It consists of predefined values.

None No data binding
Custom Custom defined data
DataSource Data Source
DataField Data field of the data source
NumericComparisonOperator Numerical comparison processors
TextComparisonOperator Text comparison processors
TrueFalse True False
YesNo Yes No
InputParameterType_DS_St_SnPar Scenario parameters
NameOfParametersToUpdateOnChange If the content of another parameter needs to be updated when the relevant parameter is changed, the name of that parameter is written in this field. For example, when the data source changes, the data field list is updated and the data fields of that data source are listed.
3.3.Adding Code with Expression

The code that should run when the expression is run <UserCodeTemplate> is added to the node.

It may be necessary to use a parameter value selected by the user in the code. In this case, \$parametername.Value\$ adds the value of the parameter, and \$parametername.Text\$ adds the text value to the code.

<DataScenarioExpressionSnippet>
    <Name>FileCopy</Name>
    <GroupName>File</GroupName>
    <LabelTr>Kopyala</LabelTr>
    <LabelEng>Copy</LabelEng>
    <DevLanguageId>CSharp</DevLanguageId>
    <LstParameters>
        <DataScenarioExpressionSnippetParameter>
            <Name>P1_ParameterType</Name>
            <LabelTr>Kaynak Dosya Parametresi</LabelTr>
            <LabelEng>Source File Parameter</LabelEng>
            <ControlType>DropDownList</ControlType>
            <BoundDataType>InputParameterType_DS_St_SnPar</BoundDataType>
            <NameOfParametersToUpdateOnChange>
                    P2_DataSource;P3_DataField;P4_StaticValue;P5_SnParValue
            </NameOfParametersToUpdateOnChange>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P2_DataSource</Name>
            <LabelTr>Veri Kaynağı</LabelTr>
            <LabelEng>Data Source</LabelEng>
            <ControlType>DropDownList</ControlType>
            <BoundDataType>DataSource</BoundDataType>
            <NameOfParametersToUpdateOnChange>P3_DataField</NameOfParametersToUpdateOnChange>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P3_DataField</Name>
            <LabelTr>Veri Alanı</LabelTr>
            <LabelEng>Data Field</LabelEng>
            <ControlType>DropDownList</ControlType>
            <BoundDataType>DataField</BoundDataType>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P4_StaticValue</Name>
            <LabelTr>Değer</LabelTr>
            <LabelEng>Value</LabelEng>
            <ControlType>SelectFileTextBox</ControlType>
            <BoundDataType>None</BoundDataType>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P5_SnParValue</Name>
            <LabelTr>Sen. Parametre</LabelTr>
            <LabelEng>Scn. Parameter</LabelEng>
            <ControlType>TextBox</ControlType>
            <BoundDataType>None</BoundDataType>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P6_ParameterType</Name>
            <LabelTr>Hedef Dosya Parametresi</LabelTr>
            <LabelEng>Destination File Parameter</LabelEng>
            <ControlType>DropDownList</ControlType>
            <BoundDataType>InputParameterType_DS_St_SnPar</BoundDataType>
            <NameOfParametersToUpdateOnChange>
                P7_DataSource;P8_DataField;P9_StaticValue;P10_SnParValue
            </NameOfParametersToUpdateOnChange>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P7_DataSource</Name>
            <LabelTr>Veri Kaynağı</LabelTr>
            <LabelEng>Data Source</LabelEng>
            <ControlType>DropDownList</ControlType>
            <BoundDataType>DataSource</BoundDataType>
            <NameOfParametersToUpdateOnChange>P8_DataField</NameOfParametersToUpdateOnChange>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P8_DataField</Name>
            <LabelTr>Veri Alanı</LabelTr>
            <LabelEng>Data Field</LabelEng>
            <ControlType>DropDownList</ControlType>
            <BoundDataType>DataField</BoundDataType>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P9_StaticValue</Name>
            <LabelTr>Değer</LabelTr>
            <LabelEng>Value</LabelEng>
            <ControlType>SelectFileTextBox</ControlType>
            <BoundDataType>None</BoundDataType>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P10_SnParValue</Name>
            <LabelTr>Sen. Parametre</LabelTr>
            <LabelEng>Scn. Parameter</LabelEng>
            <ControlType>TextBox</ControlType>
            <BoundDataType>None</BoundDataType>
        </DataScenarioExpressionSnippetParameter>
        <DataScenarioExpressionSnippetParameter>
            <Name>P11_Overwrite</Name>
            <LabelTr>Üstüne yaz</LabelTr>
            <LabelEng>Overwrite</LabelEng>
            <ControlType>DropDownList</ControlType>
            <BoundDataType>TrueFalse</BoundDataType>
        </DataScenarioExpressionSnippetParameter>
    </LstParameters>
    <UserCodeTemplate>
string sourceFilePath = "";
if("\$P1_ParameterType.Value\$" == "DataSource")
    sourceFilePath = planDataInstanceManager.GetDataTableValueFromCurrentDataRowIndex(\$P2_DataSource.Value\$, "\$P3_DataField.Text\$").ToString();
else if("\$P1_ParameterType.Value\$" == "Constant")
    sourceFilePath = @"\$P4_StaticValue.Text\$";
else if("\$P1_ParameterType.Value\$" == "ScenarioParameter")
    result_ = planDataInstanceManager.GetParameter("\$P5_SnParValue.Text\$", ref sourceFilePath);
if(!result_)
    throw new ArgumentException("Scenario source parameter does not exist : \$P5_SnParValue.Text\$ ");

string destFilePath = "";
if("\$P6_ParameterType.Value\$" == "DataSource")
    destFilePath = planDataInstanceManager.GetDataTableValueFromCurrentDataRowIndex(\$P7_DataSource.Value\$, "\$P8_DataField.Text\$").ToString();
else if("\$P6_ParameterType.Value\$" == "Constant")
    destFilePath = @"\$P9_StaticValue.Text\$";
else if("\$P6_ParameterType.Value\$" == "ScenarioParameter")
    result_ = planDataInstanceManager.GetParameter("\$P10_SnParValue.Text\$", ref destFilePath);
if(!result_)
    throw new ArgumentException("Scenario destination parameter does not exist : \$P10_SnParValue.Text\$ ");

bool overwrite = false;
if("\$P11_Overwrite.Value\$" == "1")
    overwrite = true;

System.IO.File.Copy(sourceFilePath, destFilePath, overwrite);
    </UserCodeTemplate>
</DataScenarioExpressionSnippet>