Exercise 4

Version 2

    Create a custom data reference

     

    Objective: Develop a custom data reference that builds a string by concatenating values of attributes together.

     

    You will learn how to use the standard substitution syntax as well as how to look up attribute references. The String Concatenation Data Reference operates by separating the configuration string into semi-colon separated list of attributes and strings. Strings should be enclosed in double quotes.

     

    For example, let's suppose you have two attributes:

     

    Attributes name

    Value

    SourceString1

    ABD

    SourceString2

    CDE

     

    If the configuration string of the attribute using the String Concat Data reference is SourceString1;SourceString2, then the final results will be ABDCDE.

     

    You are also going to provide a user interface for editing its configuration string, as shown below:

     

    Picture 6.png

     

    Challenge: Create the Substring Concat data reference.

     

    Instead of concatenating values directly from attributes, in this case, first the values of the attributes are going to be processed by the library to generate Substrings (defined by two specified indices). Then, the final value will be the concatenation from all substrings.

     

    For example, let's suppose you have two attributes:

     

    Attributes name

    Value

    Start indice

    End indice

    Substring

    SourceString1

    ABCDEF

    2

    4

    BCD

    SourceString2

    GHILMN

    1

    3

    GHI

     

    Therefore, after the concatenation, the final result will be BCDGHI. You are able to define the structure of the config string in order to save all the required information. Remember to edit the user interface as well.