# Report displays variable name instead of a property value

**URL:** <https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607>\
**Category:** Module Design\
**Created:** [August 3, 2023, 6:08pm UTC](https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607 "2023-08-03T18:08:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![steenkh](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/steenkh/32/9815_2.png) [@steenkh](https://forum.vassalengine.org/u/steenkh)\
**Post date:** [August 3, 2023, 6:08pm UTC](https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607/1 "2023-08-03T18:08:47Z")

</div>

This game has hidden movement, and dummy counters exist. I want to report when a counter disappears and appears on the map, and this can easily be achieved with a report expression like  
$PieceName$ has disappeared at $location$

However, because the dummy counters need to look like normal counters, I have put an appropriate string in a marker property called DisplayName, and non-dummy counters simply have $PieceName$ in the DisplayName.

However the report expression  
$DisplayName$ has disappeared at $location$  
shows  
DisplayName has disappeared at 0705

How can I get the report expression to show the value of DisplayName instead of the name?

---

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [August 3, 2023, 6:23pm UTC](https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607/2 "2023-08-03T18:23:05Z")

</div>

Rather than use a Marker trait to contain the DisplayName, try using a Dynamic Property.

---

<div class="post-metadata">

**Author:** ![JoelCFC25](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/joelcfc25/32/2687_2.png) [@JoelCFC25](https://forum.vassalengine.org/u/JoelCFC25)\
**Post date:** [August 3, 2023, 6:27pm UTC](https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607/3 "2023-08-03T18:27:36Z")

</div>

> [@steenkh](#):
>
> However the report expression  
> $DisplayName$ has disappeared at $location$  
> shows  
> DisplayName has disappeared at 0705

It’s not clear to me if you are referencing the auto-report formats that you set in a map’s config, or the contents of a Report Action piece trait. Can you supply screenshots of which things you’ve configured?

For instance, I don’t believe you can get user-defined piece properties to appear in the reports generated by the multiple “Auto-report format for…” lines in a map’s configuration. You’d have to do some jockeying to temporarily copy the values into a Global Property. [Some background here](https://forum.vassalengine.org/t/show-counter-dynamc-property-in-auto-report-format-for-movement-within-this-map-in-map-window-object/75089/8).

---

<div class="post-metadata">

**Author:** ![steenkh](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/steenkh/32/9815_2.png) [@steenkh](https://forum.vassalengine.org/u/steenkh)\
**Post date:** [August 3, 2023, 10:27pm UTC](https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607/4 "2023-08-03T22:27:03Z")

</div>

Thanks both of you for the suggestions. It was the Report Action Piece trait that I was talking about.

I solved the problem by turning the Marker trait into a Dynamic Property. There was some head-scratching because Dynamic Properties remove any variable name surrounded by $ as the initial value, but I could change the value into $PieceName$ by letting it listen for a command.

The result works very well.

---

<div class="post-metadata">

**Author:** ![cholmcc](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/cholmcc/32/8319_2.png) [@cholmcc](https://forum.vassalengine.org/u/cholmcc)\
**Post date:** [August 4, 2023, 7:10am UTC](https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607/5 "2023-08-04T07:10:25Z")

</div>

Hi,

It seems like you have something like

```
Mark Trait:
   name: 'DisplayName'
   value: 'some-name' or '$PieceName$'

Report Trait:
    key: some key
    report: '$DisplayName$ has disappeard at $location$' 

```

Perhaps try

```
Mark Trait:
     name: 'DiplayName'
     value: 'some-name' or '{BasicName}'

Report Trait:
     key: some key 
     report: '{DisplayName+" has disappeard at "+LocationName}'

```

That is, use BeanShell [expression](https://vassalengine.org/doc/latest/ReferenceManual/Expression.html#top) rather than old-style property references. You may also want to consider to use the [`Basic Name`](https://vassalengine.org/doc/latest/ReferenceManual/BasicName.html) trait in your dummy counters so that they get an appropriate `BasicName` property.

If you cannot set the [`Mark Trait`](https://vassalengine.org/doc/latest/ReferenceManual/PropertyMarker.html#top) value by a BeanShell expression, i.e., to set `DisplayName={BasicName}` then you can use a conditional in your [`Report Trait`](https://vassalengine.org/doc/latest/ReferenceManual/ReportChanges.html#top)

```
Report Trait:
     key: some key 
     report: '{(DisplayName==""?BasicName:DisplayName)+" has disappeard at "+LocationName}'

```

or the `DisplayName` property for regular pieces can be set via a [`Calculated Property Trait`](https://vassalengine.org/doc/latest/ReferenceManual/CalculatedProperty.html) as

```
Calculated Property Trait:
    name: 'DisplayName'
    expression: '{BasicName}' 

```

You only need a [`Dynamic Property Trait`](https://vassalengine.org/doc/latest/ReferenceManual/DynamicProperty.html#top) if the property value can change according to some key command.

Yours,  
_Christian_

---

<div class="post-metadata">

**Author:** ![steenkh](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/steenkh/32/9815_2.png) [@steenkh](https://forum.vassalengine.org/u/steenkh)\
**Post date:** [August 4, 2023, 5:27pm UTC](https://forum.vassalengine.org/t/report-displays-variable-name-instead-of-a-property-value/77607/6 "2023-08-04T17:27:54Z")

</div>

Thanks a lot for the comprehensive catalog of ideas.

The concept of a DisplayName is now also used for some units that need to have more attributes shown than others, and these attributes can change, so I am not sure if I should leave DP, but your ideas could help with other problems that I have encountered.
