Bug 111888 - change method of creating variables in Writer's "Fields" dialogue to allow creating variables without inserting
Summary: change method of creating variables in Writer's "Fields" dialogue to allow cr...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 92662 (view as bug list)
Depends on:
Blocks: Fields-Variable
  Show dependency treegraph
 
Reported: 2017-08-17 20:16 UTC by Roman Kuznetsov
Modified: 2023-05-12 08:56 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
mockup change method of creating a new variable (143.25 KB, image/png)
2017-08-17 20:17 UTC, Roman Kuznetsov
Details
Inserting a User Field, without inserting a field into the document (49.71 KB, image/png)
2020-01-05 14:18 UTC, sdc.blanco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kuznetsov 2017-08-17 20:16:20 UTC
Description:
change method of creating of variable in Writer's dialogue "Fields".

Today you must follow steps:
1. Open dialogue Fields (Ctrl+F2)
2. Go to tab Variables
3. Select type - Set variable
4. Enter Name of variable and enter Value of variable
5. Push button Insert (it insert new field in your document, that you don't need)
6. Repeat step 3-5
7. Delete all new fields with new variable from document! (I know, that there is checkbox "Invisible")

I offer change method of creating a new variable (see mockup from attach)
1. Delete text box "Value"
2. Assign a default value to the variable or/and make entering value of variable optional
3. For create a new variable don't need to insert new field in the document. Need just select existing green checkbox "Apply". It create a new variable and clean text box Name for create next variable.

Actual Results:  
too much steps for create a new variable in dialogue "Fields". It insert new fields in the document, then user should delete them

Expected Results:
simple process of creating a new variable in dialogue "Fields"


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
Comment 1 Roman Kuznetsov 2017-08-17 20:17:02 UTC
Created attachment 135629 [details]
mockup change method of creating a new variable
Comment 2 Dieter 2017-08-21 15:18:00 UTC
I also think, that it is not necessary to insert a new field in the document, if you create a new variable => set to NEW
Comment 3 Mike Kaganski 2017-08-21 18:54:26 UTC
Well, I do believe that it's no value in creating variables without relevant fields. Because without a value-setting field, the variable is simply useless (at least), needlessly takes a bit of memory, and might confuse one later when one supposes that the variable has some meaningful value.
Comment 4 Roman Kuznetsov 2017-08-21 19:13:03 UTC
(In reply to Mike Kaganski from comment #3)
> Well, I do believe that it's no value in creating variables without relevant
> fields. Because without a value-setting field, the variable is simply
> useless (at least), needlessly takes a bit of memory, and might confuse one
> later when one supposes that the variable has some meaningful value.

Ok, but i want after creating of variable insert in to document Input field. I must delete variable field and insert instead it in to document Input field

I can offer else one method:
1. Do not delete text field "Value", but make this optional field. If option is not active - variable == default, if option is active - user types value of variable. By default this option not active.
2. In addition to button Insert, make it possible to create a variable without insert field in document with using green checkbox.
Comment 5 Dieter 2017-08-21 19:44:25 UTC Comment hidden (obsolete)
Comment 6 Roman Kuznetsov 2017-08-22 05:03:34 UTC
(In reply to Dieter Praas from comment #5)
> @kompilainenn: I don't understand why you changed the version back to
> master. The earliest affected version is requested.

because this is enhancement
Comment 7 Roman Kuznetsov 2019-01-31 16:37:41 UTC
*** Bug 92662 has been marked as a duplicate of this bug. ***
Comment 8 sdc.blanco 2020-01-04 14:05:57 UTC
- modified summary to highlight intention

If the idea is to make it easier for 'input field', then perhaps it could/should be achieved directly with an enhancement to the 'input field' dialog (e.g., so the variable can be created as part of that dialog).
Comment 9 sdc.blanco 2020-01-04 22:00:41 UTC
(In reply to Roman Kuznetsov from comment #6)
> because this is enhancement

If you are using the variable globally, then what is wrong with using the Type "User Field" (in Variables tab of Field dialog)?  This already does everything that you have described in step 3 (of the proposed procedure) in comment 0.
Comment 10 Mike Kaganski 2020-01-05 06:01:40 UTC
(In reply to sdc.blanco from comment #9)
> what is wrong with using the Type "User Field" (in Variables tab of Field
> dialog)?  This already does everything that you have described in step 3
> (of the proposed procedure) in comment 0.

It doesn't. The green checkbox is clickable, true; but it does not add a new variable without inserting the field. At least it seems so in my testing with Version: 6.5.0.0.alpha0+ (x64)
Build ID: adf7031e3a35fe9d43085e8b223a6e36d20a32f4
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: CL
Comment 11 sdc.blanco 2020-01-05 14:18:21 UTC
Created attachment 156941 [details]
Inserting a User Field, without inserting a field into the document

(In reply to Mike Kaganski from comment #10)
> It doesn't. The green checkbox is clickable, true; but it does not add a new
> variable without inserting the field.
Just to be sure I understand correctly. See attachment.  This was done with 6.3.4.2 (but it can also be done with 6.5.0.0.alpha).

I have circled the active Apply/Delete buttons to show that the MyVar "exists". (bottom right).  And I have circled the "eof" at the top of document (with View Field Names checked) to show that no field was inserted.    

I did not use the "Insert" to create this variable, but I can go directly to "Input field" and use "MyVar" to make a functional input field.  (but I cannot show this with Ctrl-F9 -- see bug #129760, comment 3 )

Did you use Insert?  Can you get it to work as described in the previous paragraph, without Insert "User Field"?
Comment 12 Mike Kaganski 2020-01-05 14:38:49 UTC
(In reply to sdc.blanco from comment #11)

Ah I see what I forgot: the checkbox is active even without the value, but then it does nothing (this would be nice to fix).
Comment 13 sdc.blanco 2020-01-05 15:59:08 UTC
(In reply to Mike Kaganski from comment #12)
> (In reply to sdc.blanco from comment #11)
> 
> Ah I see what I forgot: the checkbox is active even without the value, but
> then it does nothing 

The checkbox does more than "nothing".  It actually creates a usable variable with the name in "Name" (with or without a value)

> (this would be nice to fix).

What is "broken" that needs to be "fixed"?

The current behavior is exactly as requested in this enhancement (where the value will be set as part of the Input Field insert).

It is also possible to "insert" User Fields with or with (or without) values (without first having to use the "apply" button).   (in other words, all variations are possible, without extra clicks)

"User Fields" do not show up in "Select" for type "Show Variable"  -- maybe because they are global, so no real need to check the value at different locations.

The only "limitation" with this "User Field" solution is if one wants to use different values of the variable in different parts of the document.
Comment 14 Mike Kaganski 2020-01-05 16:37:45 UTC
1. Ctrl+F2->Variables->User Field
2. Put "Foo" into Name box
3. Put "Bar" into Value box
4. Delete everything from Value box (!)
5. Try to push the checkmark.
Comment 15 Mike Kaganski 2020-01-05 16:49:56 UTC
(In reply to sdc.blanco from comment #13)
> The only "limitation" with this "User Field" solution is if one wants to use
> different values of the variable in different parts of the document.

This is not "the only limitation", this is the whole difference. Variables are useful exactly because they may change in different parts. User field is another entity, with own applications. Any talk about User Fields here is off-topic (except to show example how variables should be modified).
Comment 16 sdc.blanco 2020-01-06 02:11:45 UTC
(In reply to Mike Kaganski from comment #14)
> 5. Try to push the checkmark.

As long as I select a format (e.g., "Text" or "General"), I can add new variables without problem (e.g., writing values and deleting them, switching cursor focus to Name).  And in the cases where Apply does not work, if I select a format, then I can add the variable with Apply). (tested with 6.3.4.2)

But I understand that "User Fields" are not relevant here.  So that was that.
Comment 17 Eike Rathke 2023-04-02 16:03:53 UTC
Note that "Set variable" sets the variable to its value _at the position where it is inserted to the document_. Setting and inserting the same variable with a different value at another position sets the variable to that value _from that position_ on.

I doubt that setting a variable without inserting it would make sense at all.
Comment 18 Eyal Rozenberg 2023-05-12 08:54:11 UTC
(In reply to Eike Rathke from comment #17)
> Note that "Set variable" sets the variable to its value _at the position
> where it is inserted to the document_. Setting and inserting the same
> variable with a different value at another position sets the variable to
> that value _from that position_ on.
> 
> I doubt that setting a variable without inserting it would make sense at all.

Why? Suppose I want a variable to have value '234' for a while, then to have value '123' - but without anything being visible on the document. Say, because I intend to use this value in other fields which do result in text appearing in the document. Is that not a reasonable request?

Of course, there's the problem of how to indicate this has happened when the field results in no text.
Comment 19 Mike Kaganski 2023-05-12 08:56:56 UTC
(In reply to Eyal Rozenberg from comment #18)
> Why? Suppose I want a variable to have value '234' for a while, then to have
> value '123' - but without anything being visible on the document. Say,
> because I intend to use this value in other fields which do result in text
> appearing in the document. Is that not a reasonable request?

You are mixing two things: inserting and being visible. You are free to insert with hidden flag; insertion creates a *point* at which the field changes its value, and Eike's phrase means that having a variable definition not bound to a point in document doesn't make sense (but actually it makes, to manage the *initial* value).