Modify

#20851 closed defect (fixed)

Tagging preset: value_template does not update value, right away, with conditions

Reported by: skyper Owned by: team
Priority: normal Milestone: 21.07
Component: Core Version: latest
Keywords: template_report tagging preset value_template condition update Cc: simon04

Description (last modified by skyper)

Sorry, simon04. I really love this feature but it still is not working properly. Thanks for your work.

What steps will reproduce the problem?

  1. Have a condition in the expression for value_template="" like the one in #20842.
  2. Have a relation selected matching the preset with some of the tags already tagged
  3. Open the preset, change a tag which is used in the expression with a condition, like route=*.
    <group name="Public Transport" icon="presets/transport/bus.svg">
        <item name="Public Transport Route (Rail)" icon="presets/misc/route.svg" type="relation" preset_name_label="true">
            <link wiki="Public_transport#Service_routes" />
            <space />
            <key key="type" value="route" />
            <combo key="route" text="Route type" values="train,subway,monorail,tram,light_rail" values_searchable="true" match="keyvalue!" />
            <key key="public_transport:version" value="2" /> <!-- only validate marked relations in order to avoid false positives -->
            <text key="name" text="Name" value_template="?{route=train 'Train'|route=subway 'Subway'|route=monorail 'Monorail'|route=tram 'Tram'|route=light_rail 'Light_rail'|''} {ref}?{': {from} - {via} - {to}'|': {from} - {to}'|''}" />
            <text key="ref" text="Reference" />
            <text key="from" text="from" />
            <text key="to" text="to" />
            <text key="via" text="Via" />
        </item> <!-- Public Transport Route (Rail) -->

What is the expected result?

The value is adjusted right away, after changing any tag which is used in the expression.

What happens instead?

The value might be adjusted when closing the dialog with "ok" but not always

Please provide any additional information below. Attach a screenshot if possible.

It work with tags not part of a condition, like ref=*.
Opening the preset after closing changes the value again to the correct content.
The expression, especially conditions, are not always evaluated after changing an involved tag.

One more question: Is it wise to change an existing value, automatically, without user's interaction??
Think we need at least a preference option to enable/disable this feature of overwriting values.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-05-04 21:01:14 +0200 (Tue, 04 May 2021)
Revision:17860
Build-Date:2021-05-05 01:30:58
URL:https://josm.openstreetmap.de/svn/trunk

Plugins:
+ tagging-preset-tester (35640)

Tagging presets:
+ ${HOME}/JOSM/new/resources/data/defaultpresets_17833_route_17661_18662.xml

Attachments (3)

josm_20851_open_preset.png (16.3 KB) - added by skyper 12 months ago.
open preset with values
josm_20851_remove_from.png (16.3 KB) - added by skyper 12 months ago.
remove from value in preset
josm_20851_reopen_preset.png (16.4 KB) - added by skyper 12 months ago.
reopen preset after close with incorrect value

Download all attachments as: .zip

Change History (20)

comment:1 Changed 13 months ago by skyper

Description: modified (diff)

comment:2 Changed 13 months ago by skyper

Cc: simon04 added
Description: modified (diff)

comment:3 Changed 13 months ago by skyper

Description: modified (diff)

comment:4 Changed 13 months ago by simon04

Milestone: 21.05
Owner: changed from team to simon04
Status: newassigned

comment:5 Changed 13 months ago by simon04

In 17875/josm:

see #20851, see #20842 - Revert "Fix UOE in TaggingPresetItemGuiSupport.evaluateCondition"

This reverts commit r17859.

comment:6 Changed 13 months ago by simon04

Resolution: fixed
Status: assignedclosed

In 17876/josm:

fix #20851, see #20842 - Tagging presets: value_template="..." for conditional template

comment:7 Changed 13 months ago by simon04

In 17877/josm:

see #20851 - Tagging presets: value_template="..." for <combo>

comment:8 in reply to:  description Changed 12 months ago by skyper

Replying to skyper:

One more question: Is it wise to change an existing value, automatically, without user's interaction??
Think we need at least a preference option to enable/disable this feature of overwriting values.

See #20861.

comment:9 Changed 12 months ago by skyper

Description: modified (diff)

comment:10 Changed 12 months ago by skyper

Thanks, it does nicely update now.

Is it possible to use java functions (e.g. mapcss java functions) in the expressions to solve my problem with multiple values which I want to split?
May you, please, take another look at the documentation at the bottom of the attributes' section. Try & Error is not the best method to document a new function.

Last edited 12 months ago by skyper (previous) (diff)

comment:11 Changed 12 months ago by skyper

Resolution: fixed
Status: closedreopened

Sorry, but there is still a minor glitch using above preset.

  1. Have a relation matching the preset with from=*, to=* and via
  2. Open preset and remove the values for all three tags.
    • I still find two - in name=* which are never deleted no whether I delete the the whole value of name=* nor changing any other tag's value.
  3. Close preset
    • wrong name value
  4. Open preset again
    • Finally the correct value is used.

comment:12 Changed 12 months ago by simon04

Can you share a screenshot, please?

Changed 12 months ago by skyper

Attachment: josm_20851_open_preset.png added

open preset with values

Changed 12 months ago by skyper

Attachment: josm_20851_remove_from.png added

remove from value in preset

Changed 12 months ago by skyper

reopen preset after close with incorrect value

comment:13 Changed 12 months ago by skyper

Well, I changed the expression a little bit but the problem still exists:

<text key="name" text="Name" value_template="?{route=train 'Train'|route=subway 'Subway'|route=monorail 'Monorail'|route=tram 'Tram'|route=light_rail 'Light_rail'|''}?{' {ref}'|''}?{': {from} - {via} - {to}'|': {from} - {to}'|''}" />

Open preset with some tags already added to the relation:

open preset with values

Remove from=*, which should remove everything behind "Train".

remove from value in preset

Closing the presets leads to the incorrect value Train: - B - C.
Reopening the preset finally leads to the correct value.

reopen preset after close with incorrect value

comment:14 Changed 12 months ago by simon04

In 17919/josm:

fix #20952, see #20851 - Revert "Tagging presets: value_template="..." for <combo>"

This reverts commit r17877

comment:15 Changed 12 months ago by simon04

Milestone: 21.05
Owner: changed from simon04 to team
Status: reopenednew

comment:16 Changed 10 months ago by Don-vip

Milestone: 21.07

comment:17 Changed 10 months ago by Don-vip

Resolution: fixed
Status: newclosed

In 18080/josm:

fix #21156 - fix #20851 - see #20861 - disable value_template for multiple selection (patch by marcello)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.