For example, if we add a team for each participants ; and a new field color:
!$data={"partlen": "2", "game": "GamePlantuml", "participants": [
{"name": "XYZ" ,"as": "xyz", "team": "A"},
{"name": "RST" ,"as": "rst", "team": "B"},
{"name": "UVW" ,"as": "uvw", "team": "B"}],
"color": {"A": "red", "B": "blue"}
}
How to access to the color of the team, from a participant on a foreach loop?
According to: the last answer and the usage of '%string()'
We test:
:access to json: [$data.color.A, $data.color.B] $part.team -> $data.color.%string($part.team);
:access to json: [$data.color.A, $data.color.B] $part.team -> $data.color[$part.team];
:access to json: [$data.color.A, $data.color.B] $part.team -> $data.color.($part.team);
:access to json: [$data.color.A, $data.color.B] $part.team -> %get_variable_value($data.color,".",$part.team);
But with no success.
- Is it possible with te current version?
- or is it on the road map of a new release?
Here is the full code:
@startuml
!$data={"partlen": "2", "game": "GamePlantuml", "participants": [
{"name": "XYZ" ,"as": "xyz", "team": "A"},
{"name": "RST" ,"as": "rst", "team": "B"},
{"name": "UVW" ,"as": "uvw", "team": "B"}],
"color": {"A": "red", "B": "blue"}
}
:a;
!foreach $part in $data.participants
:$part.name as $part.as;
:access to json: [$data.color.A, $data.color.B] $part.team -> $data.color of $part.team;
':access to json: [$data.color.A, $data.color.B] $part.team -> $data.color.%string($part.team);
':access to json: [$data.color.A, $data.color.B] $part.team -> $data.color[$part.team];
':access to json: [$data.color.A, $data.color.B] $part.team -> $data.color.($part.team);
':access to json: [$data.color.A, $data.color.B] $part.team -> %get_variable_value($data.color,".",$part.team);
!endfor
:b;
@enduml |
http://www.plantuml.com/plantuml/uml/hOzFRy8m3CNl-HJ60er9MGyx5cq2BhjE-xyXD9aIMASqGKdA_Y2---A2rB1pJ_7p-yL-7lj0BjIL5ht-aW9TxN0J6rePp04lKGAkgL8iRk9xgyampNtcogBSn8wF_apiq1pHbzSt18daMNp__38U55Ki9xYN2Nft_z2YpeSKdPwYZq_FBLfll_wXSocmiDgwg7SuuQvJIuQcN2zqhN0lzaBaD1AzbNMAYW_eynbG6cZEpzAZ143Us1ad0F9mKEH7R55HAEyXMFZqrkGmEqne8cGJ2QcSpez_EIzSNAScs5LYykYppcPd0nzSQTR3bZZlTiEiTUOTP-yuz62jmlkMN4aBhMAXQpLCFaZCK9vix2cpN5adyiL8Z6DTL_eF
Regard,