Conditional Filtering

Conditional filtering supports setting on the connection line between two tools, allowing operations to be performed based on different conditions to receive data input that meets the conditions, enabling differentiation of different data in business.

Parameter Setting

Conditional filtering supports multiple data types, including strings, datasets (Dataset and FeatureRDD), and numerical types. According to different data types, there are different conditional functions, as follows:

  • String
Conditional Function Description Parameter Type
String Matching Determine whether a string matches the specified criteria Matching method: Supports both regular expressions and wildcards< Regular expression: Use pre-defined specific characters and combinations of specific characters to form a rule string, and use this rule string to filter the string< Br>- Wildcard: Commonly used to blur search for files, (*) can be used instead of one or more characters, for example, AEW * can be entered to find all types of files starting with AEW< Invert: If checked, it indicates that the string does not match the specified condition
If the file name determines whether the file name meets the specified conditions File name: Wildcard characters are supported< Invert: If checked, it indicates that the file name does not meet the specified conditions
Connection Information Matching Determine whether the specified connection information data source or dataset exists Type: Optional Data Source or Dataset
Existence: Determine whether a data source or dataset that meets the conditions exists. If checked, it indicates existence
  • Dataset
Conditional Function Description Parameter Type
If the field exists Determine whether the specified field exists in the dataset Field existence criteria: at least one matches, all matches, and none matches< Field: Field name, can be set multiple times, and supports the use of wildcards< Invert: If checked, it indicates that the specified field does not exist in the dataset
If the coordinate system is , determine whether the specified coordinate system exists in the dataset EPSG encoding< Invert: If checked, it indicates that the dataset does not have the specified coordinate system
If the dataset name is , determine whether the dataset name meets the specified conditions Matching method: A method for determining whether a dataset name meets the criteria, supporting both wildcards and regular expressions< Br>Dataset name< Invert: If checked, it indicates that the dataset name does not meet the specified conditions
If the number of records is , determine whether the number of records in the dataset meets the specified conditions Comparison method: greater than, less than, equal to, greater than or equal to, less than or equal to, and not equal to< Comparison value: number of records. When filled in as 0, it can be used to determine whether the dataset is empty
  • FeatureRDD
Conditional Function Description Parameter Type
If the field exists Determine whether the specified field exists Field existence criteria: at least one matches, all matches, and none matches< Field: A field name used to determine whether a field meets the criteria. Multiple fields can be set, and wildcards are supported< Invert: If checked, it indicates that the specified field does not exist
  • Number
    Conditional Function Description Parameter Type
    If the value is , it determines whether the input value meets the conditions Comparison method: supports 6 methods including greater than, less than, greater than or equal to, less than or equal to, equal to, and not equal to< Compare values< Negate: If checked, the set condition parameters will be negated during runtime< Else: Refers to situations other than meeting multiple set conditions, usually used when there are three or more filtering conditions

Usage scenario

Scenario 1: Batch data warehousing

By using the following model to achieve the storage of batch data, it is necessary to add and import similar element data from different paths, and divide the data in large batches to improve application efficiency. Due to the data being stored in multiple sub folders with a unified naming format, conditional filtering can be used to filter similar feature data. The specific operation is as follows:

Firstly, click on the connection line between the 'Iteration File' and the 'Residential Area (Point)' tools. Next, set the filtering conditions through the parameter panel, select the condition type "If the file name is", determine whether the file name meets the specified conditions, and if the conditions are met, perform an additional import. For example, enter * resp * to determine if there is resp in the data file name, and if so, perform an additional import as residential data.

Scenario 2: Batch Data Projection Information Check

When preprocessing batch data, conditional filtering can be used to check whether the projection information of the data is consistent. In the following model, it is necessary to convert the coordinate system of the dataset into WGS_ 1984。

We click on the connection line between [Image Dataset] and [Dataset Projection Conversion] and set the filtering conditions. Select the condition type 'If the coordinate system is', input EPSG code 4326 to check if the coordinate system of the input data is WGS_ 1984。 Tick 'Invert' to indicate that if the coordinate system is not WGS_ In 1984, execute 'Dataset Projection Conversion' to convert the dataset projection to WGS_ 1984。

Usage Scenario 3: Combining with Iterative Files

The following model requires batch classification and warehousing of diverse types of data, importing CSV, SHP, and TIF data separately. Condition functions can be used to filter data of the same type, selecting the condition type "string matching" to determine whether the data type matches. If it matches, subsequent import data will be executed. For example, if a *. csv matching expression is entered, only the data with the extension name. csv will be filtered, and the CSV type data will be imported.

Scenario 4: Combined with conditional grouping

When using conditional filtering in iServer, it can be combined with conditional grouping to filter branches of different conditions and aggregate them into the same subsequent processing process. Taking batch import of CSV data as an example, it is necessary to create a data source and then import CSV data into that data source. However, when repeatedly executing the model, execution failure may occur due to the presence of a data source. Each time the data source name needs to be modified, conditional filtering can be considered to solve this problem.

We first add string variables of the connection information type, which are connected to [Create Data Source] and [Iteration Dataset], and set filtering conditions on the connection line. If the specified data source exists, delete the dataset in the data source and then open the data source; If the specified data source does not exist, create the data source.

The parameter settings for conditional filtering are as follows: