-
Notifications
You must be signed in to change notification settings - Fork 0
Text Source
This is a Source Task and allows to create an Text source work task. it's used to read information from text file and transform it into a transient object (for more details on Input/Output see How to work wiki page)
Text Reader or filename. see below for more info about task configuration
IEnumerable<IRow> result
This result represents an IEnumerable of IRow (for more details on Input/Output see How to work wiki page). The IEnumerable of IRow represents the read information from Text Reader/filename
The implementation of text source task is:
FlowBuilder builder = new FlowBuilder(_logger);
var flow = builder.Create("Text Source Work Task")
.Then(task => task.CreateTextSource()
.From(filePath)
.ParseAsFixedColumns(fixColumn, false)
.AddOtherField(() => "IsValid")
.Build())
.Build();
flow.Run();
This task can be configurated in several way:
ITextSource From(TextReader reader);
you need to specify a text reader start to read a file. This field is Optional but you need to specify a text source (text reader or filename)
ITextSource From(string file);
you need to specify a filename to start to read a file. This field is Optional but you need to specify a text source (text reader or filename)
ITextSource ParseAsFixedColumns(int[] colWidths, bool useHeader);
This method is called to specify the witdh of the with a fixed length. You need to specify an array of number that represents the column width. the order of witdh specify the applied column: for example if you create an array int[3] {4,2,5}, the column 1 will have a width = 4, the column 2 will have a width = 2 and at the end the column 3 will have a wifth = 5. Moreover you can specify if the text contains an header.
This field is Optional but you need to specify a kind of parser (parser with fixed column or parser with a delimited char).
ITextSource SkipWhen(Func<string, bool> func);
This is a function that is used to skip a row in base of a specific logic. This field is Optional
ITextSource ParseAsDelimited(char delimiter, bool useHeader);
This method is called to specify the delimiter char used in the text. Moreover you can specify if the text contains an header.
This field is Optional but you need to specify a kind of parser (parser with fixed column or parser with a delimited char).
ITextSource ParseAsDelimited(char[] delimiters, bool useHeader);
This method is called to specify the delimiter char array used in the text. You need to specify an array of different delimiter char. the order of delimiter specify the applied column: for example if you create an array char[3] {',','.',';'}, the column 1 will have as delimiter the "," char, the column 2 will have as delimiter the "." char and at the end the column 3 will have as delimiter the ";" char. Moreover you can specify if the text contains an header.
This field is Optional but you need to specify a kind of parser (parser with fixed column or parser with a delimited char).
ITextSource ParseWith(Func<string, IEnumerable<string>> lineSplitter, bool useHeader);
Specify a function that use a custom implementation to decide how to split the row. Moreover you can specify if the text contains an header. This field is Optional
ITextSource AddOtherField(Func<string> fieldName);
This method allows to specify other adding field that will be inserted at the end of the IEnumerable<IRow> result object with null value. This feature is used to add a field that will be filled in the next specified task
Inside the Engine
Work Task
- Create New Custom Task
- Source Work Task
- Destination Work Task
- Generic or Base Work Task