PHP instance method
DataRow->mand
Description
Get a field. Aborts import of this single subject, if data is missing.
Comments
The mandatory check is performed *before* and *after* the converters are applied. A data cell is considered empty (and thus missing) when it contains the empty string after trimming or if it is <code>null</code> after application of the converters.
Examples
Case is not significant. Both works:
[%$row->mand("City");
$row->mand("city");%]
Using a converter:
[%$row->mand("dob", "parse_date"); %]
Using datatype and format:
[%$row->mand("dob", datatype: "date");%]
Datatypes %date%, %time% and %datetime% assume ISO format. If your data source uses a different format, you need to specify which one:
[%$row->mand("dob", datatype: "date", format: "d.m.Y");%]
|
Parameters3
Coding name |
col_name
|
Description |
The name of the column to get. Or a reference to another import subject already extracted from this row.
|
Position |
1
|
Type |
String(Primitive type)
|
Comments |
There is no need to change this in case a column changes name in the source data. Use the <code>options</code> for the <code>TableReader</code> to rename the column.
|
Coding name |
converter
|
Description |
The name of function to convert the data. It is passed the string and returns a PHP native type, e.g. DateTime or boolean.
|
Position |
2
|
Type |
|
Comments |
Any number of converters can be passed as an array, they are applied in sequence until one return a non-null value.
|
Coding name |
datatype
|
Position |
3
|
Type |
String(Primitive type)
|
Default value |
string.
|
Comments |
Value space: data, time, datetime, integer, decimal, boolean.
|
|
We are sorry
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.