Test operators and parameters¶
For file datasets¶
filesize()¶
Description : Returns the file size in bytes. This function must be used with source@type='file'
Parameters: No parameters
Example:
<check label="Spatialite file size in octet">
<source type="file" dataset="result\dbcountry.sqlite" request="fileSize()"/>
<condition comparator="in range" expectedvalue="[5630000,5645000]"/>
</check>
For datasets of type datafile¶
featuresCount()¶
Description: Returns the number of entities in the dataset or in one or more specific entity types. This function must be used with source@type='datafile'
Parameters: The check@requestparams attribute may contain a space-separated list of entity types to be counted. If requestparams is not set or is empty, featuresCount() returns the total number of entities in the dataset.
Example: Number of features in the country and spatial_ref_sys feature types in the SQLite dataset.
<check label="Number of features in country and spatial_ref_sys">
<source type="datafile" format="SQLITE3" dataset="./result/dbcountry.sqlite" request="featuresCount()" requestparams="country spatial_ref_sys"/>
<condition comparator="eq" expectedvalue="4925"/>
</check>
Total number of entities in the SQLite dataset.
<check label="Number of features in country and spatial_ref_sys">
<source type="datafile" format="SQLITE3" dataset="./result/dbcountry.sqlite" request="featuresCount()"/>
<condition comparator="eq" expectedvalue="4925"/>
</check>
featuresCountByFtAndGeometry()¶
Description: Returns the number of entities in the dataset by entity type and by geometry type. This function is particularly powerful for quickly checking the contents of complex datasets such as AutoCAD DWG or PDF. The result is returned in the following form:
ft.geom:count
where:
ft: name of the feature type
geom: type of geometry (value of the format attribute fme_geometry)
count: number of features found.
The character | delimits the elements of the list.
Parameters: No parameters
Example: Number of features per entity and geometry type in an ESRI Shapefile.
<check label="Country name in Shapefile in a simple directory from featuresCountByFtAndGeometry()">
<source type="datafile" format="ESRISHAPE" dataset="./result/COUNTRY.shp" request="featuresCountByFtAndGeometry()"/>
<condition comparator="eq" expectedvalue="COUNTRY.fme_donut:1"/>
</check>
Example result:
frame.fme_polygon:1|generic edge.fme_line:125|generic edge.fme_point:125
attributeValue()¶
Description: Returns the value of an attribute for a given record.
Parameters: It is necessary to use requestparams to set three parameters to the attributeValue() function.
The first is the name of the features type
The second is the name of the field to be returned
The third is the record index (start at 1)
The parameters are separated by a comma.
Example: The value of the "NAME" field of the first record of the "COUNTRY" feature type.
<check>
<source type="datafile" format="ESRISHAPE" dataset="./result/COUNTRY.shp" request="attributeValue()" requestparams="COUNTRY,NAME,1"/>
<condition comparator="eq" expectedvalue="Switzerland"/>
</check>
For datasets of type database¶
There is no test operator for database datasets. Instead, it is necessary to use an SQL query in the source@dbrequest attribute to calculate the observed value. This mechanism is much more powerful and allows to ensure almost all possible checks on a dataset.