Hi, Instead of adding a new "hard" field to the data you may also add a "virtual field" that you can then use for several data-defined properties. That will also reflect the changes if the data below changes. I think this should be pretty much what you want?
Regards, Matthias On 02/24/2015 03:17 PM, Mofo Yoda wrote: > Hi, > When I use data defined properties, I can set the expression for colour and > width etc. > But what I really want to do is to set the variable once and use the same > variable inside multiple expressions for many symbols in my project. > So I can change the value of that variable in one place, and automatically > change all symbols, that use this variable in their expressions. > It should be a kind of global variable for all symbols. > > The only workaround I can think of is to store variable values as fields of > data itself (I use postgis db, so this is potentially possible) and use a > fields value in the expression, > like “fill_color_field” for color, but that’s very inconvenient, and I guess > there should be a better way. > Is it possible using ‘function editor’ in expression maybe? > > >> On 24 Feb 2015, at 16:07, Jonathan Moules <j.mou...@hrwallingford.com> wrote: >> >> Hi, >> Yes, it is. >> You want the "Data defined properties" button, which you'll see when you >> click on a style (in 2.6.1, it's at the bottom of the list of style options. >> >> The variables need to be of a specific datatype/structure for each item you >> want to style. So Pen Width requires a double. Colour is more complex, >> requiring a RGBA string. The dialog shows what's necessary. >> >> Cheers, >> Jonathan >> >> -----Original Message----- >> From: qgis-user-boun...@lists.osgeo.org >> [mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of Mofo Yoda >> Sent: Tuesday, February 24, 2015 11:19 AM >> To: qgis-user@lists.osgeo.org >> Subject: [Qgis-user] Variables for colour values >> >> I wonder if it’s possible to use variables for colour values, line widths >> etc? I have rule-based styling with lots of rules, and I want to change the >> colour value in one place and not in every rule that uses the same symbol. >> I’ve been using variables a lot in CartoCSS styling, but I really miss them >> in QGIS. Since I can define project colours with names in QGIS, i thought it >> may be possible somehow. >> I’m on QGIS 2.8 for OS X. >> _______________________________________________ >> Qgis-user mailing list >> Qgis-user@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/qgis-user >> >> This message has been scanned for viruses by MailControl - >> www.mailcontrol.com >> >> >> >> Click >> https://www.mailcontrol.com/sr/mFTpBfgLOMLGX2PQPOmvUgZ1F1vOh!vyYC82CsCGa!dzAI3m6djTRny+7419ROQTNWG5s0VsQtSURD1dro2FIg== >> to report this email as spam. >> >> ________________________________ >> >> HR Wallingford and its subsidiaries uses faxes and emails for confidential >> and legally privileged business communications. They do not of themselves >> create legal commitments. Disclosure to parties other than addressees >> requires our specific consent. We are not liable for unauthorised >> disclosures nor reliance upon them. >> If you have received this message in error please advise us immediately and >> destroy all copies of it. >> >> HR Wallingford Limited >> Howbery Park, Wallingford, Oxfordshire, OX10 8BA, United Kingdom >> Registered in England No. 02562099 >> >> ________________________________ > _______________________________________________ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user