Skip to main content
2 of 2
edited title
underdark
  • 84.5k
  • 22
  • 233
  • 415

How to convert string to field?

I've recently updated to QGIS 2.14, and have started using the custom variables feature implemented in 2.12. I was wondering whether it was possible to use the custom variable to select a field in the expression builder?

For example, I have a table containing data for three different time periods (AM, IP and PM). If I define a variable "TimePeriod", I'd like to be able to select a field in the expression builder for both labels and style in a way similar to

"@TimePeriod Count"

(where "AM Count", "IP Count" and "PM Count" are three fields in the table)

Is this possible? If so, what would the correct syntax be?