Data Iterator Parsing a TAB Delimited txt file

 8 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
gastonak
Basic Member
Posts: 21
Basic Member
    I have a TAB delimited file I am trying to parse but it is ignoring the tabs. The outer Data Iterator reads each line and inside this loop, I have the Line Data Iterator "DLINE" with the setting "Parse By = Delimiter String". For the delimiter value, I am using the variable vTAB='\t'. The value of "DLine_outputData1" is the same as the entire line which indicates that it is ignoring the TABs. I opened the input file in note++ and I can see the tabs in each line. How should I setup Data Iterators in order to parse a file withTABs?

    Thank you,
    Gaston    
    RandyM
    Basic Member
    Posts: 9
    Basic Member
      Hey gastonak. Since you are using a variable, did you spcify it like this: . is the case correct?
      RandyM
      Basic Member
      Posts: 9
      Basic Member
        Try it again. specify it like this:
          
        gastonak
        Basic Member
        Posts: 21
        Basic Member
          I assigned the value '\t' to the variable vTAB and then I assigned  to the Delimiter String under the Data Iterator Properties.When I execute it, the variable appears as an actual tab spaces and the iterator shows DLine_outputData1 same as DLine_outputData with parsing the file. Is parsing a TAB file different that parsing other delimiters?

          Thank you.
          RandyM
          Basic Member
          Posts: 9
          Basic Member
            I have done the same thing you are doing only with the data iterators; but I have only used commas. I just wanted to make sure that since you are using a variable, the Delimiter String property is specified properly. You need to use the vTAB with the proper case and syntax the syntax must look like this:
              
            . You could also try putting '\t' directly in the Delimiter String property.
            RandyM
            Basic Member
            Posts: 9
            Basic Member
              you need to include the greater than and less than signs and the exclamation point just like I showed
              gastonak
              Basic Member
              Posts: 21
              Basic Member
                That is exactly what I am doing, I am using on my iterator and now I changed to '\t' but it makes no difference. Could you try parsing a TAB file to make sure the '\t' is not getting ignored. Thanks.
                Sam Simpson
                Veteran Member
                Posts: 239
                Veteran Member
                  I know I have done this before in both file and variable. for comma delimiter you simply put a "," in the property box and you are done. For horizontal and vertical tabs you can not just create vTAB='\t' because \t as a special character (escape sequencee) that is only recognized by some special scripting language like javascript. I think what I did is create a new function in javascript (Pflow.js) to get the ASCII equivalent of TABs. So in my processflow I would create a variable string vTAB=HorTabFunctron() where HorTabFunction is returned by javascript whose value is the non-displayed character for horizontal tab. In one of my flow I also send either the file or variable into a javascirpt function whose only purpose is to parse the string delimited by either a comma or TAB.
                  gastonak
                  Basic Member
                  Posts: 21
                  Basic Member
                    Sam,

                    I think using java Scripting works just fine. I added an Assign node task prior to the second Data Iterator "DLINE". In this task, I have a java script that replaces all of the tabs with a comma, then I assign this value to the DLine Iterator using a comma as the delimiter. This works for me but I wonder if there is an easier way.
                     
                    Thank you.