diff --git a/vector_layers_attributes/Join_table_to_vector_layer/04_open_layer_properties.md b/vector_layers_attributes/Join_table_to_vector_layer/04_open_layer_properties.md index 1a95823..18bb5b4 100644 --- a/vector_layers_attributes/Join_table_to_vector_layer/04_open_layer_properties.md +++ b/vector_layers_attributes/Join_table_to_vector_layer/04_open_layer_properties.md @@ -1,5 +1,5 @@ * In the **Layers Panel**, right-click the *Blocks 2010* layer and - select **Open Attribute Table** + select **Properties** ![open_layer_properties](open_layer_properties.png) diff --git a/vector_layers_attributes/Join_table_to_vector_layer/05_add_vector_join.md b/vector_layers_attributes/Join_table_to_vector_layer/05_add_vector_join.md index 3f55d43..83ab655 100644 --- a/vector_layers_attributes/Join_table_to_vector_layer/05_add_vector_join.md +++ b/vector_layers_attributes/Join_table_to_vector_layer/05_add_vector_join.md @@ -1,7 +1,5 @@ * In the **Layers Properties - Blocks 2010**, click the **Join** tab. - ![open_joins_tab](open_joins_tab.png) - * There are no joins yet for this layer. Click the **Add Join** button to create one. diff --git a/vector_layers_attributes/Join_table_to_vector_layer/functions.py b/vector_layers_attributes/Join_table_to_vector_layer/functions.py new file mode 100644 index 0000000..1058fa0 --- /dev/null +++ b/vector_layers_attributes/Join_table_to_vector_layer/functions.py @@ -0,0 +1,25 @@ +from lessons.utils import layerFromName + +# Functions + +# EndCheck Function + +def fieldExists(layername, string): + """ + Check if a layer has a field which name contains the specified string + The layer should be of the vector type and be loaded into project. + :param layername: Layer's name as visible in the layers panel + :param string: string of text + + :return: Boolean + """ + + layer = layerFromName(layername) + if layer is None: + return False + + for field in layer.pendingFields(): + if string in field.name(): + return True + + return False \ No newline at end of file diff --git a/vector_layers_attributes/Join_table_to_vector_layer/lesson.yaml b/vector_layers_attributes/Join_table_to_vector_layer/lesson.yaml index f915335..df07d72 100644 --- a/vector_layers_attributes/Join_table_to_vector_layer/lesson.yaml +++ b/vector_layers_attributes/Join_table_to_vector_layer/lesson.yaml @@ -12,7 +12,28 @@ lesson: name: Inspect attribute of tabular layer - description: 04_open_layer_properties.md name: Open layer properties + + prestep: + name: utils.unmodalWidget + params: + - QgsVectorLayerPropertiesBase + - 300 + - 1000 + - description: 05_add_vector_join.md name: Add vector join + + prestep: + name: utils.unmodalWidget + params: + - QgsJoinDialog + - 300 + - 1000 + + endcheck: + name: fieldExists + params: + - Blocks 2010 + - TOTAL_POP - description: 06_inspect_polygon_layer_attributes_(again).md name: Inspect polygon layer attributes (again) diff --git a/vector_layers_attributes/Join_table_to_vector_layer/open_joins_tab.png b/vector_layers_attributes/Join_table_to_vector_layer/open_joins_tab.png deleted file mode 100644 index 8cce620..0000000 Binary files a/vector_layers_attributes/Join_table_to_vector_layer/open_joins_tab.png and /dev/null differ