Customer Portal

Using Complex Data Reader to select Metadata based on fields

Comments 3

  • Avatar
    slechtaj
    0
    Comment actions Permalink
    Hi,

    if I understand your question correctly, you would just like to remove certain characters/strings from records. Particularly you would like to get rid off {someChars}. For this you do not need to use ComplexDataReader, which is designed to read heterogeneous structured data. All you need to do is to read the whole line into one field and using replace() function remove aforementioned strings. It may look like this:
    $out.0.row = replace($in.0.row,"\\|\\{.*?\\}","");

    Where the first argument is the input field that you want to update, the second one contains escaped regular expression and the last argument contains the value that should be used to replace the strings that match the previous regular expression.

    The example is attached.

    Hope it helps.
  • Avatar
    welshed2
    0
    Comment actions Permalink
    Actually, it's that I am dealing with two types of metadata. One of them has 21 fields and the other has 20 fields. The extra field is right in the middle of them all.

    You can tell based on the file name which type of data it will be, and I am trying to use ComplexDataReader to sort between the two and appropriately select the correct metadata.
  • Avatar
    slechtaj
    0
    Comment actions Permalink
    Hi,

    there are multiple ways to do this. In this case, I would probably go the way of checking what type of file I am processing and depending on that run appropriate graph. However, if you would like to use ComplexDataReader, you should configure the selector that will use the metadata of which regular expression matches the input record. I have prepared for you an example that consumes two types of metadata.

    • The first one has four string fields delimited by |

    • The second one has four string fields delimited by the same delimiter


    See the selector tab in ComplexDataReader in the attached project for more information. For more information about ComplexDataReader, please refer to our documentation: http://doc.cloveretl.com/documentation/ ... eader.html

    Hope this helps.

Please sign in to leave a comment.