Hi Bernd, From your explanation it did not become quite clear to me what you actually want to achieve.
My guess is that you are struggling with a similar issue which a colleague of mine had with the raster map calculator. He was wondering how to use numerical variables in the raster map calculator, which takes the formula only as a string argument (probably it is the same with the Field calculator (I am not so familiar with this part of QGIS)?). The, probably not very elegant, but still simple solution is to generate the formula in a python script in Processing, which injects your numerical values into the formula. E.g. like this (where "F" is the formula and "C" e.g. a (string) map variable you are going to use in the formula): ##A=number 1 ##B=number 5 ##F=output string F=str(A) + "/" + str(B) + "* C" You can then uses this Python script in your model... Hope that helps. It works at least well for the raster map calculator... Cheers, Stefan -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Bernd Vogelgesang Sent: 9. august 2015 16:07 To: [email protected] Subject: [Qgis-user] Modeler-only tools: Calculator Hi, In my search for a solution for the problem, that number input variables in a model can't be referred to in the field calculator (while string inputs, though it doesn't make any sense, can): 2 years old http://hub.qgis.org/issues/8743 http://gis.stackexchange.com/q/72569 I found the modeler-only tools Calculator, which indeed lists all numerical inputs. This tool doesn't come with any explanation besides: "You can refer to model values in your formula, using single-letter variables, as follows: a->Gridsize and [Enter your formula here] Ok, so when I enter a formula there, what next???? When I put - a - there, cause I just want this value, and try to use - a - in the field calculator, it does not work. Furthermore: The formula has disappeared after reopening the function: http://hub.qgis.org/issues/11434#note-9 It does not seem to be usable at all. And it destroyed my three-days work on a model, cause by mistake I entered nothing and hit ok and saved the thing, which caused a python error and the model can't be opend again. Only the fact that I work on a cloud where I can restore my last version from yesterday has saved my ass. (Working locally, the hole work would have been gone forever!). There seems to be no way to get rid of that function from the model manually in a text editor, identifying the section and removing it still leaves a crippled model which refuses to load. Questions: Is there anyone around who is able to explain me the structure of a model file or point to least some minimal documentation?. Why do nearly every manual operations on a model in an editor destroy them, and how can I avoid this? Does anyone know how to use this Calculator without destroying the model? Is there any workaround for referencing numerical input in the field calculator. Cheers Bernd QGIS2.8.3, Linux Mint 17 -- Bernd Vogelgesang Siedlerstraße 2 91083 Baiersdorf/Igelsdorf Tel: 09133-825374 _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
