Read data from csv file

I have a requirement to read the data from a .csv file and plot the graph based on the values present in it.
I have used File Adapter for this purpose, but I am not able to fetch the data from the file.
The sample file which I used, has following data
and below is the code I used to fetch these values from the file. This code is written in the monitor file’s “onload” action.

            com.apama.file.OpenFileForReading openCSVFileRead := new com.apama.file.OpenFileForReading;
	openCSVFileRead.transportName := "JMultiFileTransport";
	openCSVFileRead.requestId := 1;
	openCSVFileRead.codec := "JCSVCodec";
	openCSVFileRead.filename := "D:/Test.txt";
	openCSVFileRead.payload["separator"] := ",";
	emit openCSVFileRead to "FILE";
	com.apama.file.FileError readError := new com.apama.file.FileError;
	readError.transportName := "JMultiFileTransport";
	readError.requestId := 1;
	on com.apama.file.FileError():readError
		emit readError to "FILE";
	com.apama.file.FileHandle readHandle := new com.apama.file.FileHandle;
	readHandle.transportName := "JMultiFileTransport";
	readHandle.requestId := 1;
	on com.apama.file.FileHandle():readHandle
	emit readHandle to "FILE";
	com.apama.file.ReadLines readLines := new com.apama.file.ReadLines;
	readLines.transportName := "JMultiFileTransport";
	readLines.numberOfLines := 2;
	readLines.requestId := 1;
            on com.apama.file.ReadLines():readLines
		emit readLines to "FILE";
	com.apama.file.FileLine fileLine := new com.apama.file.FileLine;
	fileLine.transportName := "JMultiFileTransport";
	fileLine.requestId := 1;	
	on com.apama.file.FileLine():fileLine
	emit fileLine to "FILE";

The code runs with out any error, But when I run in debug mode the fileLine event will have nothing in the data[] field.

I have also tried using FileReader V2.0 for the purpose of reading the file but while opening the file in my scenario, it throws an error, “The current file has not been opened on this transport”. Currently I am using “JMutliFileTransport” as transport name for file reader, and specifying the exact path for the file, Lines in Header is 0 and File channel is #(default value)
Let me know

  1. Which one is the suggested approach to use for my requirement?
  2. What modification should I do to get the file data in the first approach.?
  3. If we are able to read data successfully by first approach, should we write it to some event file to plot the graph?
  4. What modification should I do to get the file data in the second approach.?

Thank you


Just a note that this forum is intended for the wider Apama community to ask questions and reply to each other.
For this type of question, customers and partners of Software AG will almost certainly get the best response by contacting the Support team using Empower (