[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qgis-user
Subject:    Re: [Qgis-user] Formatting dynamic text
From:       Grant Boxer via QGIS-User <qgis-user () lists ! osgeo ! org>
Date:       2023-01-25 4:42:26
Message-ID: 008b01d93077$6ce3cc10$46ab6430$ () iinet ! net ! au
[Download RAW message or body]

This is a multipart message in MIME format.

[Attachment #2 (multipart/alternative)]
This is a multipart message in MIME format.


Many thanks, I will give it a try,

Cheers Grant

 

 

From: David Strip <qgis-user@stripfamily.net> 
Sent: Wednesday, 25 January 2023 12:27 PM
To: qgis-user <qgis-user@lists.osgeo.org>; boxerg@iinet.net.au
Subject: re: Formatting dynamic text

 

I am trying to use the dynamic text option  [%item_variables('Map
1')['map_scale']%] in my print layout but I get a scale of 100000.000000007
in my title block. How can I apply a format number to get it to display a
whole number like 100000?


I don't know how to do it using dynamic text, but you can get what you want using this expression

[% round(map_get( item_variables('Map 1'), 'map_scale'),0)%]


[Attachment #5 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:Consolas;}
span.EmailStyle20
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" \
vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p \
class=MsoNormal><span style='mso-fareast-language:EN-US'>Many thanks, I will give it \
a try,<o:p></o:p></span></p><p class=MsoNormal><span \
style='mso-fareast-language:EN-US'>Cheers Grant<o:p></o:p></span></p><p \
class=MsoNormal><span \
style='mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span \
style='mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><div><div \
style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p \
class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> David Strip \
&lt;qgis-user@stripfamily.net&gt; <br><b>Sent:</b> Wednesday, 25 January 2023 12:27 \
PM<br><b>To:</b> qgis-user &lt;qgis-user@lists.osgeo.org&gt;; \
boxerg@iinet.net.au<br><b>Subject:</b> re: Formatting dynamic \
text<o:p></o:p></span></p></div></div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>I am trying to use the dynamic text \
option   [%item_variables('Map<o:p></o:p></pre><pre>1')['map_scale']%] in my print \
layout but I get a scale of 100000.000000007<o:p></o:p></pre><pre>in my title block. \
How can I apply a format number to get it to display a<o:p></o:p></pre><pre>whole \
number like 100000?<o:p></o:p></pre></blockquote><p class=MsoNormal><br>I don't know \
how to do it using dynamic text, but you can get what you want using this \
expression<o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p \
class=MsoNormal>[% round(map_get( item_variables('Map 1'), \
'map_scale'),0)%]<o:p></o:p></p></blockquote></div></body></html>



_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic