archi
archi copied to clipboard
Label ${properties:separator:key} in ${if:condition:display_value1:display_value2} shows unexpected results
Version of Archi
4.9.2
Archi Plug-ins
none
Operating System
Win 10
Expected Behaviour
In the below explanation I would expect with the not connected Note in row 4 the same result as in row 3. Or did I misunderstood something?
Actual Behaviour
In a Note Label this is entered:
- "$connection:target{property:REMARK}"
- "$connection:target{properties: --- :REMARK}"
- "${if:$connection:target{property:REMARK}:('REMARK' properties found):(no 'REMARK' properties found)}"
- "${if:$connection:target{property:REMARK}:$connection:target{properties: --- :REMARK}:(no 'REMARK' properties found)}"
The Note is not connected and shows following result, here row 4 is strange for me:
- ""
- "$connection:target{properties: --- :REMARK}"
- "(no 'REMARK' properties found)"
- "${if::$connection:target{properties: --- :REMARK}:(no 'REMARK' properties found)}"
When I connect this Note to an object with two 'REMARK' properties following is shown and what I expected:
- "1. value of 'REMARK' property."
- "1. value of 'REMARK' property. --- 2. value of 'REMARK' property."
- "('REMARK' properties found)"
- "1. value of 'REMARK' property. --- 2. value of 'REMARK' property."
Thanks and kind regards.
Can you please attach a simple model that demonstrates this problem with simple instructions on what to expect. I'm having difficulty understanding your problem. Maybe if you reduced it to a simple case it would help.
Good morning, please find attached a model with just this issue. Also a screenshot as it looks on my screen. Thanks for your help.
Issue 805 Example.archimate.zip
Seems to be do with the :
character and escaping them.
@jbsarrodie Can you see the problem here?
Hi,
This is due to some discrepencies in the way ${property}
and ${properties}
work. In the first case, it renders to an empty string if there's no connection, in the second one, it doesn't render at all (and left you with the label expression unchanged).
I'm investigating to find the root cause of this...
I'm investigating to find the root cause of this...
Done ;-)
In PropertiesRenderer.java
, text.replace
is called outside of the refObject instanceof IProperties
check for property
, but inside for properties
.
@Phillipus for the sake of consistency, I'd suggest to alway have text.replace
inside, this would make it clear that the expression has not been evaluated because the prefix was invalid. If you're ok I can commit a (really small) patch.
Seems to be do with the
:
character and escaping them.
That's what I first though, but no :-)
Seems to be do with the
:
character and escaping them.That's what I first though, but no :-)
But, if I submit a patch, I can also use this opportunity to refactor a bit the regexp for $prefix{properties:separator:propname}
so that colon can be escaped and used as part of the separator.
OK for a patch, thanks for looking at this.
Hi, will it fix the following as well?
I can share a model to show it. If you want me to do this, please tell me, how I can upload the model file.