Dynamic Layer Name with FeatureWriter Transformer to update to ArcGIS Portal
I have a workspace in 2023.2.1 that is writing to ArcGIS Portal.
What I am finding that in some cases the original layer that is in portal had spaces in the layer name i.e. Layer Name. When it is written to Portal either FME or Portal replaces the spaces and with underscores i.e. Layer_Name and when I try to update it, FME can’t find the layer as it is looking for the original name with the spaces.
The only attribute that is available is fme_feature_type or my user parameters.
Is there a way to create a parameter prior to both of these writers that replaces the spaces with underscores and is then available to the FeatureWriter layer name attribute?
Page 1 / 1
Hi @deanhowell ,
If the point of the question was "How to replace space in an attribute value with underscore", I think StringReplacer would be a general solution.
Thanks @takashi that part I have figured out but just can't get that attribute as part of the layer name for the feature writer transformer
Why not create a extra python scripted parameter $(_protallayernamecorrected) where spaces are replaced by underscores?
Thanks @nielsgerrits I have never tried this but looks like a possible option. Cheers Dean
Thanks @nielsgerrits I have never tried this but looks like a possible option. Cheers Dean
Just be sure the scripted parameter is under the original parameter because parameters are processed in the order from top to bottom, else _protallayernamecorrected can’t find _protallayername and it will fail.
@deanhowell , you can use ParameterFetcher to assign the value of a user paremeter to a new attribute, and set the attribute to the feature type name parameter in the FeatureWriter.
Alternatively, you can also use the @ReplaceString function to set the required layer name to the feature type name parameter in the FeatureWriter.
Thanks again @takashi. I am using a string replacer to update the fme_feature_type and that is getting me a step closer, but because I need to use the dynamic schema (although maybe that is my issue for the update) to ArcGIS Portal, the only attribute I can use is fme_feature_type
It is now finding the right layer in portal but giving me a python error when trying to update
Does the fme_feature_type_name on the schema have the value with the spaces or with the underscores?
Thanks all for the suggestions and assistance. I ended up using a python caller earlier in the workbench to replace any spaces in the actual file names with underscores.
Good to hear you got a solution, but I think there might be a simpler way without using Python script.
According to the original screenshot you posted, you have configured dynamic schema derived from schema feature, and set "fme_feature_type" to the Schema Definition Name parameter. I assume that you are using FeatureReader to read the source dataset and the schema feature output from the <Schema> port of FeatureReader as the schema source.
In that case, the value of attribute called "fme_feature_type_name" in the schema feature should match the schema definition name - i.e. the value of "fme_feature_type" in the data features. That is, I think, if you have modified the value of "fme_feature_type" in the data features - i.e. replaced space with underscore, you can just modify "fme_feature_type_name" in the schema feature as well as the same way, so that the dynamic schema definition could work as expected.
Thanks @takashi I will give that a go as well and see.