I have a simple graphical model that uses a Field calculator to build a URL by concatenating strings in 3 fields of its input layer. This URL should be fed into the Download File algorithm using the Pre-calculated Value parameter.
For reproducibility, a valid download URL is:
https://pkgstore.datahub.io/core/geo-countries/countries/archive/23f420f929e0e09c39d916b8aaa166fb/countries.geojson
How do I use an expression in the Download File algorithm (Pre-calculated Value) to query the Field Calculator output?
Normally, on a map layer, to get the content of the url field of the feature with id = 1, I would use:
attribute(get_feature_by_id('layer_name', 1), 'url') In the expression builder there is a variable called @Field_calculator_OUTPUT, however substituting this for the layer name does not work:
attribute(get_feature_by_id( @Field_calculator_OUTPUT, 1), 'url') The following error is thrown whereby there is no URL argument given:
Running Download file [3/3] Input Parameters: { DATA: '', METHOD: 0, OUTPUT: 'D:\\OneDrive\\geodata\\countries.geojson', URL: None } No URL specified Error encountered while running Download file Execution failed after 0.18 seconds I know that the URL is valid, I have tested it with the Download File tool outside the Graphical Modeller
I have tried using 'Calculated' for the layer name in the expression and also using the Rename Layer algorithm and using the new layer name in the expression. I have also set the Field Calculator as a dependency of Download File.
I cannot get the expression to recognise the output of the Field calculator as a layer. The expression works if the layer is already present in the layer tree.
There is some degree of recognition of the layer because entering @Field_calculator_OUTPUT in the expression makes a link between the two algorithms.


Download filedialog?Download Filealgorithm will not pick it up until it is present in the layer tree. Which either means having separate models for the calculation and downloading the file, or running the model twice, the first time with an error, so that theDownload Filerecognises the output as a map layer. Neither of which are particularly favourable. It should just be an intermediate step in the overall model. This is why I generally stick to scripts and not models.