Changes

Jump to: navigation, search

Gramps 4.1 Wiki Manual - Reports - part 2

852 bytes added, 21:57, 5 February 2016
m
Protected "Gramps 4.1 Wiki Manual - Reports - part 2": outdated user manual ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
== The Substitution Keys ==
 
{| {{prettytable}}
|-
Format strings are used to display names and dates differently than those assigned under Gramps Preferences. Here is the syntax for a format string:
$''{{man label|key}}''(format string)<br />
where: ''{{man label|key}}'' is one of the following characters: 'nsijbmBMdvDVauet'
=== Formatting names ===
For names <code>($n $s) </code> you may use the following formatting codes to display the name differently.
{|{{prettytable}}
|-
|!t
|Title
||!f
|Given name
|-
|!x
|Common name. Call name if existing, otherwise first first name
||!c
|Call name
|-
|!n
|Nick name
||!s
|Suffix
|-
|!l
|Surname
||!g
|Family nickname
|}
These codes can be uppercased upper-cased to uppercase the result.
For example:{|{{prettytable}}
|-
|Example !Formatting code|!Displays
|-
|<pre>$n(L, f) ($n(c)), $n(L, f){ ($n(c))}
Janice Ann Adams</pre>
|}
{{man note|Note:|If you want to print a character 'c' within the format string (or any one of the other format codes), you will need to first add a <code>'&#92;'</code> in front of it. See [[#Control Variables|Control Variables]] for more.}}
 <blockquote>{{man note|Note:If you want to print a character 'c' within the format string (or any one of the other format codes), you will need to first add a '&#92;' in front of it. See [[#Control Variables|Control Variables]] for more.The curly brackets </blockquotecode{ }<blockquote/code>Note:the curly brackets { } are used to hide information. Here it is used around <code>' ($n(c))' </code> to not display <code>' ()' </code> if the person does not have a call name. See [[#Grouping|Grouping]] for more.</blockquote> ----}}
=== Formatting Dates ===
For all of the date variables <code>($b $d $m $v)</code> you may use the following formatting codes:
For all of the date variables ($b $d $m $v) you may use the following formatting codes: {|{{prettytable}}
|-
|!yyyy
|The year as a four digit number
||!yyy
|The year, with a minimum of three digits
|-
|!yy
|The year, from 00 to 99
||!y
|The year, from 0 to 99
|-
|!mmmm<BR>'''MMMM'''
|The full name of the month<BR>
The full name IN CAPS
||!mmm<BR>'''MMM'''
|The abbreviated name of the month<BR>
The abbreviated name IN CAPS
|-
|!mm
|The month, from 00 to 12
||!m
|The month, from 0 to 12
|-
|!dd
|The day, from 00 to 31
||!d
|The day, from 0 to 31
|-
|!o
|The date type (modifier)
||!
|
|}
For example:{|{{prettytable}}
|-
|Example !Formatting code|!displays
|-
|<pre>$b(mmm-dd yy)
|}
{{man notewarn| For date types (modifier) |Only "Before", "After", and "About" are supported at this time. all others will not display anything.<BR>And for date span and date ranges, only the starting (first) date is displayed.}} ----
=== Formatting Places ===
For all of the place variables <code>($B $D $M $V)</code> you may use the following formatting codes:
For all of the place variables ($B $D $M $V) you may use the following formatting codes: {|{{prettytable}}
|-
|!e
|Street
|
|!l
|Locality
|-
|!c
|City
|
|!u
|County
|-
|!s
|State
|
|!p
|Postal Code
|-
|!n
|Country
|
|!t
|Title
|-
|!x
|Longitude
|
|!y
|Latitude
|}
These codes can be uppercased upper-cased to uppercase the result.
For example:{|{{prettytable}}
|-
|Example !Formatting code|!displays
|-
|<pre>$B
Carmel, IN, USA</pre>
|}
 
----
=== Rules for format strings. ===
{||-|1|* Anything will print inside a format string|-|1a|you will have * You need to use [[#Control Variables|Control Variables]] to display things like <code>')' </code> and format codes|-|2|* Separators can be within format strings.|-|3|* At least ONE format code has to display something for the ENTIRE format string to display|}
---- === Examples ===For examples:{|{{prettytable}}
|-
|!Formatting code|gives!displays
|-
|<pre>$n(f l)
{d. $d $D</pre>
|<pre>Edwin Michael Smith
b. 1961-05-24 at San Jose, Santa Clara Co., CA</pre>{{man label|The person is still alive (or has no information present) so the line was removed.}}
|}
For example the dollar character '$' is used to note the start of a variable. If you wish to print a dollar character you would use a control character like '&#92;$'
{| {{prettytable}}!Control Variables!Result|-!&#92;$|Displays a single <code>'$'</code>|-!&#92;&#92;|Displays a single <code>'&#92;'</code>|-!&#92;(|Displays a single <code>'('</code>|-!&#92;){|Displays a single <code>')'</code>
|-
|&#92;$|Displays a single '$'||&#92;!&#92;{|Displays a single <code>'&#92;{'</code>
|-
|&#92;(|Displays a single '('||!&#92;)}|Displays a single <code>')}'</code>
|-
|&#92;{|Displays a single '{'||!&#92;}<|Displays a single <code>'}<'</code>
|-
|!&#92;<>|Displays a single '<code>'||&#92;>|Displays a single '</code>'
|}
Basically anything that comes after a <code>'&#92;' </code> will be printed.
----{{man note|Note:|When you are inside a format string, you may need to use this to display a character that would normally be a format code. }}
For example:{|{{prettytable}}
|-
|Example!Formatting code:|would give!displays
|-
|<pre>$b(m hi mom)
$b(m hi \mo\m)</pre>
|<pre>5 hi 5o5
5 hi mom</pre>{{man label|As this person was born on the fifth month.}}
|}
 
as this person was born on the fifth month.
== Grouping ==
There are instances where you do not want certain text to be displayed. Take the example:
Take the example:{|{{prettytable}}
|-
|!Formatting Code|!Only date is known|!Only place is known
|-
|<precode>died on $d at $D</precode>|<precode>died on 1975-06-26 at </precode> |<precode>died on at Reno, Washoe Co., NV</precode>
|-
| colspan="3"|}Neither of these displayed results are very acceptable.|-| colspan="3"|But with groups (denoted by {}'''&#123;&#125;'''), you can optionally print information if a variable within contains information.|-{| colspan="3"|For example:{{prettytable}}
|-
|!Formatting Code|!Only date is known|!Only place is known
|-
|<precode>died{ on $d}{ at $D}</precode>|<precode>died on 1975-06-26</precode>|<precode>died at Reno, Washoe Co., NV</precode>
|}
Which is a more preferable displayed result than in the first example.
which is what we want.
 
----
=== Rules for groups ===
Groups can also be nested. If this happens (like below), the outer group will only display if there is at least one variable that displays something within the outer group or any of the sub groups.
Groups can also be used to remove text. If you wish to not display the entire line, <code>'-' </code> at the start of a line will remove the entire line from the display if the above rule is true.
If you do not wish to have the display code above (for death information) displayed (the person is alive, or you do not yet know the information), modify the code to look like:* <precode>-{died{ on $d}{ at $D}</precode----
=== Examples: ===
 This will hide <code>'(' </code> and <code>')' </code> if the divorce information is not known (or still married). * <precode>m. $m $M {- ($v(yyyy))</precode
Only display some spouse information if married or remove the entire line if never married:
* <precode>{$s $m(yyyy) {- $v(\(yyyy\))}}</precode>
== Attributes ==
Attributes do not have a format string. Instead the attribute name is placed inside <code>[]</code>. Here is the syntax for an attribute:
Attributes do not have a format string. Instead the $''{{man label|key}}''[attribute name is placed inside []. Here <br />where: ''{{man label|key}}'' is one of the syntax for an attributefollowing characters:'au'
$''<span style="backgroundFor example: #c0c0c0">key</span>''[attribute name] where: ''<span style="background: #c0c0c0">key</span>'' is one of the following characters: 'au'{| {{prettytable}}Example:!Formatting code {|!displays
|-
|<pre>$a[Profession]
|}
 
----
== Events ==
Events have the same starting structure as attributes, <code>$e </code> or <code>$t </code> and the event name in <code>[] </code> but events have an extra format string after the name to display the description, date, place, id, and attributes associated with it. Each of these items can be displayed with a , a 'n', 'd', 'D', 'i', and 'a' respectively in the format string. Here is the syntax for an event:
$''<span style="background: #c0c0c0">{{man label|key</span>}}''[attribute name](format string) <br />where: ''<span style="background: #c0c0c0">{{man label|key</span>}}'' is one of the following characters: 'et'
=== Event format strings ===
The Event format string is used to display information about the event. Here are the format codes to display parts of the event:
{|{{prettytable}}!Formatting code !displays!!Formatting code !displays
|-
|!n
|Description
|
|!i
|Event ID
|-
|!d
|Event Date&#42;
|
|!D
|Event Place&#42;
|-
|!a
|An attributes for the event&#42;&#42;
|
&#42;&#42;Attribute needs to have the attribute name in [] and are formatted as above.
ExampleFor example: {|{{prettytable}}!Formatting code!displays
|-
|<pre>$e[First Communion](d(yyyy-mm-d))
2007 05/23 Grandmothers house</pre>
|}
 
And:
 {|{{prettytable}}!Formatting code!!displays
|-
|<pre>$b(yyyy-Mmm-dd)
|}
=== Notes for attributes and events: ===
----Attribute and event names are mandatory. <code>'$a'</code> or <code>'$a[]'</code> will not display anything.
=== Notes for attributes and events: === {||-|1|Attribute and event names are mandatory. '$a' or '$a[]' will not display anything.|-|2|Attributes and event names may have special characters within them. Most notably <code>']' </code> and <code>')'</code>. If this is the case, you will need to use [[#Control Variables|Control Variables]]|}
== Separators ==
Separators are special 'text only' groups inside <code>'&lt;' </code> and <code>'&gt;' </code> that conditionally display a separator (like <code>', ' </code> or <code>' - '</code>) between two groups, variables, format codes or text.
Separators are displayed conditionally depending on these rules:
* A variable that does '''not''' display anything will remove itself and a separator that is to the left of it from the display line only.
* If there is not a separator to the left, the same variable will remove itself and a separator that is to the right of it from the displayed line.
* If there are two separators together, the left one will be removed from the display line and the right is kept.
* Separators at the start or end of the display line (or format strings) are removed.
# A variable that does '''not''' display anything will remove itself and a separator that is to the left of it from the display line only.# If there is not a separator to the left, the same variable will remove itself and a separator that is to the right of it from the displayed line. # If there are two separators together, the left one will be removed from the display line and the right is kept.# Separators at the start or end of the display line (or format strings) are removed === ExampleTake this example formatting code: ==={||-|* <precode>$s(f l s)&lt;, &gt;$m(yyyy)&lt; @ &gt;$M&lt; - &gt;$v(&#92;(yyyy&#92;))</precode>|}
Here are some things that may happen:
 {|{{prettytable}}!Possibility!Outcome
|-
|If '''none''' of the variables are known
|the second separator will not display
|}
 
Separators can be inside format strings:
* <code>$n(&lt;0&gt;T&lt; &gt;L&lt;, &gt;f&lt; &gt;s)</code>
$n(&lt;0&gt;T&lt; &gt;L&lt;, &gt;f&lt; &gt;s) Unlike groups, separators can not cross over/out of format strings. So the separator <code>&lt;0&gt; </code> will NEVER display. No matter what is on the left hand side of the variable. ----
Here is a useful example:
{||-|* <precode>{({b. $b}<, >{d. $d})}</precode>|}
This will:
{||-| Only print the outside () if either the birth or death date displays|-| Only displays the center separator if both dates are known.{{prettytable}}
|-
| Only print the outside () if either the birth or death date displays<br>Only displays the center separator if both dates are known.<br>So here are some thing that could display
{|
|-
| <precode>(b. 1970-4-8)</precode>| <precode>(d. 2012-3-9)</precode>| <precode>(b. 1970-4-8, d. 2012-3-9)</precode>| or the line does not print at all.
|}
|-
{|
|-
| <precode>()</precode>| <precode>(, )</precode>| <precode>(b.)</precode>| <precode>(b., )</precode>| <precode>(d.)</precode>
|-
| <precode>(, d.)</precode>| <precode>(b. 1970-4-8, )</precode>| <precode>(b. 1970-4-8, d.)</precode>| <precode>(, d. 2012-3-9)</precode>| <precode>(b., d. 2012-3-9)</precode>
|}
|}

Navigation menu