Property Match Expression

I have a game where there are leaders counters on the main map and leader mats on a private map.
The mats contain the combat units.
I’d like to sum the SPs of the combat units and show them on the leader.

I build a previous release of the game as few years ago with the old Sum function. It worked but was a bit sluggish. I ran the same module on a recent version of vassal and it worked much faster.

I am now rebuilding the module from scratch and would like to use the newer functions.

so I have a leader counter BasicName pd_leader_BELLGARDE

and a mat counter BasicName pd-mat-BELLGARDE

yes the - and _ are what they are.

I figured this should do the match

  SumMap("MATSP","{BasicName==$BasicName$.replace(\"_leader_\",\"-mat-\")}")

If I just do SumMap(“MATSP”,“AutoAOD”)
It sums just fine but for all the mats on that board.
So I am confident that it is the property match expression that is incorrect.

If I put this expression in a text label the name looks correct.

`{$BasicName$.replace("_leader_","-mat-")}`

I tried to add .trim() but it caused an expression error.

cheers
Gus

Check out this recent reply to a similar question. The technique outlines there should select based on current mat or current cargo.

If you want the leader counter on the privat window to know about properties of the leader counters on the main map, make those two counters Attachments one way or the other. I do something similar in Littoral Commander: Indo-Pacific: The unit counters on the main map are associated with a tracker card on another map. When the hit points on the tracker goes to zero, then both the counter on the main map and the tracker are eliminated. When the resource count of Long Range Strike (LRS) - for example - hits zero on the tracker card, it is no longer possible to declare LRS combat with the counter on the main map - and so on.

Yours,
Christian