Bug 154611 - Interaction between variable with same name but inserted with different formats
Summary: Interaction between variable with same name but inserted with different formats
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Fields Fields-Variable
  Show dependency treegraph
 
Reported: 2023-04-04 22:46 UTC by sdc.blanco
Modified: 2023-04-18 11:13 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sdc.blanco 2023-04-04 22:46:35 UTC
When a variable (type "user field" or type "variable") has the same name but is inserted with different formats (Text vs. General), there is an interaction between them, in terms of what is displayed, which seems wrong. (could not find any relevant documentation)

Case 1 (user field)
1. Insert variable type "user field" with "General" format, and a text string value.
   Actual: 0 is shown.
2. Insert another "user field", with same variable name, "Text" format, and a text string value.
   Actual: The text value is also shown in the first user field as well.
   (i.e., the "General" format is, in effect, overridden).

Case 2 (variable)
1. Use "set variable" to insert a variable field with "General" format, and a text string value.
   Actual: Nothing is shown.
2. Insert another "variable" field, with same variable name as the first, but "Text" format, and a text string value.
   Actual: The text value that was entered for the first variable is now shown, even though the format is "General".

In short, these two cases show how the same variable name with different formats result in "General" format fields being able to show text. Is that to be expected?
Comment 1 Eike Rathke 2023-04-04 23:53:33 UTC
Case 1:
1. looks wrong to me, but might be intentional (in sense of Word compatible behaviour). Having seen the code lately I'm tending more to assume a bug here though..
2. if you hit the check mark button that's expected; not sure what should happen if you didn't. There is no "other user field with same name", user fields are document global. But the state looks messy.

Case 2:
1. similar to case 1.
2. similar to case 2, but there should be two instances of the variable; apparently setting a new triggers redisplaying the first.

Things are a little more obvious if text1 and text2 (i.e. different texts) are used for each step.

Behaviour is the same already in OOo.
Comment 2 Eike Rathke 2023-04-05 00:04:54 UTC
> Case 2:
> 2. similar to case 2,
to case 1 of course..
Comment 3 sdc.blanco 2023-04-05 13:04:16 UTC
See bug 146737, comment 8 for an additional point that saving and reloading the document with the variables that have the same name, but different formats, results in changing the format to the last inserted instance.