The previous topic became too long for a wiki article... so this is the short version
- to add names to CSV columns you do
->pipe(new ColumnRename(array(
"Column 0" => "your_name_for_column_0",
"Column 1" => "your_name_for_column_1",
"Column 2" => "your_name_for_column_2",
...
)))
see ColumnRename process in the documentation
- to have separate access to date and time if you have mixed datetime column you do
->pipe(new CopyColumn(array(
"date"=>"datetime",
"time"=>"datetime",
)))
->pipe(new DateTimeFormat(array(
"date" => "Y-m-d",
"time" => "H:i:s"
)))
see CopyColumn process and DateTimeFormat processin the documentation
- to select data with
AND
conditions you do
->pipe(new Filter(array(
array("code","=",1000),
array("date",">=","2019-02-01"),
array("date","<=","2019-02-28"),
array("flag","=",0)
)))
(using >=
and <=
for the date works like BETWEEN
)
see Filter process in the documentation
- to select data with
OR
conditions you do
->pipe(new Filter(array(
array("value","<",10),
'or',
array("value",">",30),
)))
After the operator or
, all the condition below will use or
, if you want and
again, you need to use 'and'
- for more complicated conditions like
(a AND b) OR (c AND d)
you do
->pipe(new Custom(function($row){
if( (($row["a"] && $row["b"]) || ($row["c"] && $row["d"]) )
{
return $row;
}
}))
see Custom process in the documentation
- to group data you do
->pipe(new Group(array(
"by"=>"date",
"max"=>"datetime"
)))
"max"
- is an example only see Group process in the documentation
- to join CSV with another data source you do
$join = new Join($first_source, $second_source,
array("matching column1" => "matching column2"));
see Join process in the documentation