Workflow Soluiton

 View Only
  • 1.  Read File component

    Posted May 15, 2009 02:05 PM
    I'm having trouble getting the string data from a text file. I have a text file that I am trying to read the first line from (the only text in there, actually). I can't seem to figure out how to get that line into a single string variable.

    Any help is appreciated.


  • 2.  RE: Read File component
    Best Answer

    Posted May 15, 2009 02:19 PM
     I used the IO. Read File component to read it in, then EncodingComponents.ByteArrayToText  component to change to a string.
    Have you tried that?


  • 3.  RE: Read File component

    Posted May 15, 2009 02:49 PM
    That worked perfect!

    thanks.


  • 4.  RE: Read File component

    Posted May 15, 2009 04:58 PM
    ...once you do what yliquor suggested, you'll have the entire contents of the file in a text variable.  From that point on, there are several components in the Text Handling category which you could use to manipulate the text in your variable. 

    For example, Split Text Into Collection would split the text into a collection (array) of elements where each element is (if you use the Newline delimiter) one line of the text file...then you could use components in the Collection Handling category to work with your new array. 

    Or, you could use the Strip, Trim, Pad, etc. components to parse the text variable or drill into it further. 

    The idea, though, is that once you get the file contents into a text variable, then it's just another variable in your process stream which contains data that you can manipulate further to meet your needs in your project.