Discussion:
Virtual Fields - Allow adding fields out of edit mode
Matthias Kuhn
2014-10-06 19:12:13 UTC
Permalink
Hi,

I merged a commit today that fixes some problems with virtual fields, in
particular a crash when removing a virtual field.
As the virtual fields do not work on the data provider, they are not
directly linked to edit mode being turned on. This also allows to add
virtual fields on data providers that do not allow to add additional
fields. This led to a change in the GUI, that you are also allowed to
add fields when edit mode is turned off. I added an info, that editing
mode will be turned on, when adding real (provider) fields on the add
field dialog.
However, I am not sure how intuitive the current behavior is. As we are
approaching the final release date, I thought I'd explicitly point out
this change and ask for feedback so we can take measures if there is
hesitation to this approach.

Please share your impression and if you disagree with the current
approach it would be highly welcome if you could outline an improved way
of tackling this.

Matthias
Bernhard Ströbl
2014-10-07 08:06:00 UTC
Permalink
Hi Matthias,

there seems to be a small bug in the add field stuff: scenario
1) add a virtual field
2) add a permanent field => field is added but marked as virtual
(symbol) and name is that of the virtual field added in step 1) BUG!
3) close and reopen layer properties => field from step 2) is displayed
as it should, so the bug is on the display side only

tested with e5850f3

to your question: I think the current editing-mode behavior is
intuitive. What is not intuitive is that the expression editor can only
be launched when adding a virtual field. I am aware that I can add a
(permanent) field with the field calculator but this whole business is
IMHO not consistent.
This would be consistent:
1) in field calculator if choosing to add a new field offer to make it
virtual or permanent (permanent being default)
2) make add-field dialog be the same no matter if adding a permanent or
virtual field.

regards

Bernhard
Post by Matthias Kuhn
Hi,
I merged a commit today that fixes some problems with virtual fields, in
particular a crash when removing a virtual field.
As the virtual fields do not work on the data provider, they are not
directly linked to edit mode being turned on. This also allows to add
virtual fields on data providers that do not allow to add additional
fields. This led to a change in the GUI, that you are also allowed to
add fields when edit mode is turned off. I added an info, that editing
mode will be turned on, when adding real (provider) fields on the add
field dialog.
However, I am not sure how intuitive the current behavior is. As we are
approaching the final release date, I thought I'd explicitly point out
this change and ask for feedback so we can take measures if there is
hesitation to this approach.
Please share your impression and if you disagree with the current
approach it would be highly welcome if you could outline an improved way
of tackling this.
Matthias
__________ Information from ESET Mail Security, version of virus signature database 10522 (20141007) __________

The message was checked by ESET Mail Security.
http://www.eset.com
Matthias Kuhn
2014-10-07 12:06:07 UTC
Permalink
Thank you for testing Bernhard,
Post by Bernhard Ströbl
Hi Matthias,
there seems to be a small bug in the add field stuff: scenario
1) add a virtual field
2) add a permanent field => field is added but marked as virtual
(symbol) and name is that of the virtual field added in step 1) BUG!
3) close and reopen layer properties => field from step 2) is
displayed as it should, so the bug is on the display side only
Could you open an issue report for this so we don't forget? Thank you.
Post by Bernhard Ströbl
tested with e5850f3
to your question: I think the current editing-mode behavior is
intuitive. What is not intuitive is that the expression editor can
only be launched when adding a virtual field. I am aware that I can
add a (permanent) field with the field calculator but this whole
business is IMHO not consistent.
1) in field calculator if choosing to add a new field offer to make it
virtual or permanent (permanent being default)
It could go there indeed, good idea.
Post by Bernhard Ströbl
2) make add-field dialog be the same no matter if adding a permanent
or virtual field.
I don't completely follow. Do you propose to remove the "virtual field"
from the "add field" in favor of 1) or is the intention something else?

Best
Matthias
Bernhard Ströbl
2014-10-07 12:28:13 UTC
Permalink
Hi Matthias
Post by Matthias Kuhn
Thank you for testing Bernhard,
Post by Bernhard Ströbl
Hi Matthias,
there seems to be a small bug in the add field stuff: scenario
1) add a virtual field
2) add a permanent field => field is added but marked as virtual
(symbol) and name is that of the virtual field added in step 1) BUG!
3) close and reopen layer properties => field from step 2) is
displayed as it should, so the bug is on the display side only
Could you open an issue report for this so we don't forget? Thank you.
done : http://hub.qgis.org/issues/11342
I assigned it to you
Post by Matthias Kuhn
Post by Bernhard Ströbl
tested with e5850f3
to your question: I think the current editing-mode behavior is
intuitive. What is not intuitive is that the expression editor can
only be launched when adding a virtual field. I am aware that I can
add a (permanent) field with the field calculator but this whole
business is IMHO not consistent.
1) in field calculator if choosing to add a new field offer to make it
virtual or permanent (permanent being default)
It could go there indeed, good idea.
will the field calcuator be active all the time then?
just thinking of consequences....
Post by Matthias Kuhn
Post by Bernhard Ströbl
2) make add-field dialog be the same no matter if adding a permanent
or virtual field.
I don't completely follow. Do you propose to remove the "virtual field"
from the "add field" in favor of 1) or is the intention something else?
no, proposals 1) and 2) are independent from each other.
proposal 2) means, that the expression builder should be offered when
adding a permanent field, too, thus not changing the dialog when user
changes his choice of permanent/virtual.
Scenario is: user wants to add a permanent field and fill it with an
expression. Now it is either
1) add field and accept
2) open calculator, choose field
3) define expression and accept
or:
1) set editable
2) open calculator
3) define expression and accept

future behaviour would be:
1) add field
2) define expression and accept

Bernhard
Post by Matthias Kuhn
Best
Matthias
__________ Information from ESET Mail Security, version of virus signature database 10524 (20141007) __________

The message was checked by ESET Mail Security.
http://www.eset.com
Matthias Kuhn
2014-10-07 12:40:22 UTC
Permalink
Hi Bernhard,
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
tested with e5850f3
to your question: I think the current editing-mode behavior is
intuitive. What is not intuitive is that the expression editor can
only be launched when adding a virtual field. I am aware that I can
add a (permanent) field with the field calculator but this whole
business is IMHO not consistent.
1) in field calculator if choosing to add a new field offer to make it
virtual or permanent (permanent being default)
It could go there indeed, good idea.
will the field calcuator be active all the time then?
just thinking of consequences....
Yes
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
2) make add-field dialog be the same no matter if adding a permanent
or virtual field.
I don't completely follow. Do you propose to remove the "virtual field"
from the "add field" in favor of 1) or is the intention something else?
no, proposals 1) and 2) are independent from each other.
proposal 2) means, that the expression builder should be offered when
adding a permanent field, too, thus not changing the dialog when user
changes his choice of permanent/virtual.
Scenario is: user wants to add a permanent field and fill it with an
expression. Now it is either
1) add field and accept
2) open calculator, choose field
3) define expression and accept
1) set editable
2) open calculator
3) define expression and accept
1) add field
2) define expression and accept
I think if the user wants to add a permanent field with the help of an
expression the current solution with the field calculator is fine. I
don't see any benefit that the "add field" dialog would have over that.
On the other hand defining the virtual fields in the field calculator
(and removing them from "add field") could make things more coherent.

Any opinions about this?

Matthias
Bernhard Ströbl
2014-10-07 12:56:21 UTC
Permalink
Hi Matthias,
Post by Matthias Kuhn
Hi Bernhard,
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
tested with e5850f3
to your question: I think the current editing-mode behavior is
intuitive. What is not intuitive is that the expression editor can
only be launched when adding a virtual field. I am aware that I can
add a (permanent) field with the field calculator but this whole
business is IMHO not consistent.
1) in field calculator if choosing to add a new field offer to make it
virtual or permanent (permanent being default)
It could go there indeed, good idea.
will the field calcuator be active all the time then?
just thinking of consequences....
Yes
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
2) make add-field dialog be the same no matter if adding a permanent
or virtual field.
I don't completely follow. Do you propose to remove the "virtual field"
from the "add field" in favor of 1) or is the intention something else?
no, proposals 1) and 2) are independent from each other.
proposal 2) means, that the expression builder should be offered when
adding a permanent field, too, thus not changing the dialog when user
changes his choice of permanent/virtual.
Scenario is: user wants to add a permanent field and fill it with an
expression. Now it is either
1) add field and accept
2) open calculator, choose field
3) define expression and accept
1) set editable
2) open calculator
3) define expression and accept
1) add field
2) define expression and accept
I think if the user wants to add a permanent field with the help of an
expression the current solution with the field calculator is fine. I
don't see any benefit that the "add field" dialog would have over that.
it does not really have any, but I was wondering why I can use an
expression for virtual fields and not for permanent fields
Post by Matthias Kuhn
On the other hand defining the virtual fields in the field calculator
(and removing them from "add field") could make things more coherent.
+1, this would make the expression thing in the "add field" dialog needless
add/remove field would be only for working on the data structure; the
layer must be in editing mode, which makes your original question
obolete :) or now it is applicable to the calculator

all the best

Bernhard
Post by Matthias Kuhn
Any opinions about this?
Matthias
__________ Information from ESET Mail Security, version of virus signature database 10524 (20141007) __________

The message was checked by ESET Mail Security.
http://www.eset.com
Matthias Kuhn
2014-10-07 13:07:19 UTC
Permalink
Hi
Post by Bernhard Ströbl
Post by Matthias Kuhn
I think if the user wants to add a permanent field with the help of an
expression the current solution with the field calculator is fine. I
don't see any benefit that the "add field" dialog would have over that.
it does not really have any, but I was wondering why I can use an
expression for virtual fields and not for permanent fields
Post by Matthias Kuhn
On the other hand defining the virtual fields in the field calculator
(and removing them from "add field") could make things more coherent.
+1, this would make the expression thing in the "add field" dialog needless
add/remove field would be only for working on the data structure; the
layer must be in editing mode, which makes your original question
obolete :) or now it is applicable to the calculator
Remove field would still be available out of edit mode to remove virtual
fields.
Add field would only be available in edit mode. But the field calculator
instead available out of edit mode.


Best
Matthias
Bernhard Ströbl
2014-10-07 13:11:58 UTC
Permalink
Post by Matthias Kuhn
Hi
Post by Bernhard Ströbl
Post by Matthias Kuhn
I think if the user wants to add a permanent field with the help of an
expression the current solution with the field calculator is fine. I
don't see any benefit that the "add field" dialog would have over that.
it does not really have any, but I was wondering why I can use an
expression for virtual fields and not for permanent fields
Post by Matthias Kuhn
On the other hand defining the virtual fields in the field calculator
(and removing them from "add field") could make things more coherent.
+1, this would make the expression thing in the "add field" dialog needless
add/remove field would be only for working on the data structure; the
layer must be in editing mode, which makes your original question
obolete :) or now it is applicable to the calculator
Remove field would still be available out of edit mode to remove virtual
fields.
Add field would only be available in edit mode. But the field calculator
instead available out of edit mode.
ok, sounds good

Bernhard
Post by Matthias Kuhn
Best
Matthias
__________ Information from ESET Mail Security, version of virus signature database 10524 (20141007) __________
The message was checked by ESET Mail Security.
http://www.eset.com
__________ Information from ESET Mail Security, version of virus signature database 10524 (20141007) __________

The message was checked by ESET Mail Security.
http://www.eset.com
Matthias Kuhn
2014-10-13 16:11:47 UTC
Permalink
Hi all,

The changes have been merged to master today.

* Virtual fields are now defined from the field calculator.
* The field calculator is always available, regardless of provider
support and edit mode.
* If an action from the field calculator requires to turn edit mode
on, the user will be notified on the field calculator dialog that this
will happen automatically when clicking ok.

Please test this and open issue reports if things are not working as
expected. Thank you very much.

Matthias
Bernhard Ströbl
2014-10-14 05:36:33 UTC
Permalink
Hi Matthias,

thank you for your work!
However I have some small issues and a bug [1]
- I do not see any notification when not in edit mode but my action
requires edit mode (edit mode is turned on, though, when clicking OK)
- shouldn't "create virtual field" be the default when layer is not in
edit mode?
- could the check box "create virtual field" be placed to the right of
"create a new field"?

all the best

Bernhard

[1] http://hub.qgis.org/issues/11403
Post by Matthias Kuhn
Hi all,
The changes have been merged to master today.
* Virtual fields are now defined from the field calculator.
* The field calculator is always available, regardless of provider
support and edit mode.
* If an action from the field calculator requires to turn edit mode
on, the user will be notified on the field calculator dialog that this
will happen automatically when clicking ok.
Please test this and open issue reports if things are not working as
expected. Thank you very much.
Matthias
__________ Information from ESET Mail Security, version of virus signature database 10558 (20141014) __________

The message was checked by ESET Mail Security.
http://www.eset.com
Matthias Kuhn
2014-10-14 07:15:12 UTC
Permalink
Hi Bernhard,
Post by Bernhard Ströbl
Hi Matthias,
thank you for your work!
Thank you for the review
Post by Bernhard Ströbl
However I have some small issues and a bug [1]
- I do not see any notification when not in edit mode but my action
requires edit mode (edit mode is turned on, though, when clicking OK)
That was just fixed
Post by Bernhard Ströbl
- shouldn't "create virtual field" be the default when layer is not in
edit mode?
I think it's more predictable (and therefore increases usability) for
users if it's either always on or always off by default. Don't you think?
Post by Bernhard Ströbl
- could the check box "create virtual field" be placed to the right of
"create a new field"?
"Create a new field" is a group box.
Would you create another group box with all field type widgets? I doubt
it's easy to place it in the group box header as well. But I could
easily take it to the top, just below the header.

Best regards
Matthias
--
_______________________________________________
Help getting QGIS to the next level of quality before November 15!
http://blog.vitu.ch/10102014-1046/crowdfunding-initiative-automated-testing
Bernhard Ströbl
2014-10-14 07:44:13 UTC
Permalink
Hi Matthias,
Post by Matthias Kuhn
Hi Bernhard,
Post by Bernhard Ströbl
Hi Matthias,
thank you for your work!
Thank you for the review
Post by Bernhard Ströbl
However I have some small issues and a bug [1]
- I do not see any notification when not in edit mode but my action
requires edit mode (edit mode is turned on, though, when clicking OK)
That was just fixed
Post by Bernhard Ströbl
- shouldn't "create virtual field" be the default when layer is not in
edit mode?
I think it's more predictable (and therefore increases usability) for
users if it's either always on or always off by default. Don't you think?
Ok, agreed, so I opt for "always on" because it will always work
Post by Matthias Kuhn
Post by Bernhard Ströbl
- could the check box "create virtual field" be placed to the right of
"create a new field"?
"Create a new field" is a group box.
Would you create another group box with all field type widgets?
No of course not :-) I was not aware of the group box. I just had the
impression it should be there, so moving it on top seems adequate.

I doubt
Post by Matthias Kuhn
it's easy to place it in the group box header as well. But I could
easily take it to the top, just below the header.
Best regards
Matthias
thanks

Bernhard



__________ Information from ESET Mail Security, version of virus signature database 10558 (20141014) __________

The message was checked by ESET Mail Security.
http://www.eset.com
Matthias Kuhn
2014-10-14 07:56:00 UTC
Permalink
Hi Bernhard
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
- shouldn't "create virtual field" be the default when layer is not in
edit mode?
I think it's more predictable (and therefore increases usability) for
users if it's either always on or always off by default. Don't you think?
Ok, agreed, so I opt for "always on" because it will always work
It should be "always on" for providers that do not allow to add
attributes. For others both options always work and I prefer to keep the
previous behavior (without broad agreement that this should be changed,
if you convince some people I may change my mind ;-) ).
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
- could the check box "create virtual field" be placed to the right of
"create a new field"?
"Create a new field" is a group box.
Would you create another group box with all field type widgets?
No of course not :-) I was not aware of the group box. I just had the
impression it should be there, so moving it on top seems adequate.
Done!

Cheers
Matthias
--
Help getting QGIS to the next level of quality before November 15!
http://blog.vitu.ch/10102014-1046/crowdfunding-initiative-automated-testing
Bernhard Ströbl
2014-10-14 08:10:14 UTC
Permalink
Hi Matthias,
Post by Matthias Kuhn
Hi Bernhard
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
- shouldn't "create virtual field" be the default when layer is not in
edit mode?
I think it's more predictable (and therefore increases usability) for
users if it's either always on or always off by default. Don't you think?
Ok, agreed, so I opt for "always on" because it will always work
It should be "always on" for providers that do not allow to add
attributes.
But thus the behaviour is not predictable either (from a user's point of
view, who is just loading data into his/her project). Virtual field will
_always_ work, no matter which provider.

For others both options always work and I prefer to keep the
Post by Matthias Kuhn
previous behavior (without broad agreement that this should be changed,
if you convince some people I may change my mind ;-) ).
Anybody has an opinion on this?

Bernhard
Post by Matthias Kuhn
Post by Bernhard Ströbl
Post by Matthias Kuhn
Post by Bernhard Ströbl
- could the check box "create virtual field" be placed to the right of
"create a new field"?
"Create a new field" is a group box.
Would you create another group box with all field type widgets?
No of course not :-) I was not aware of the group box. I just had the
impression it should be there, so moving it on top seems adequate.
Done!
Cheers
Matthias
__________ Information from ESET Mail Security, version of virus signature database 10558 (20141014) __________

The message was checked by ESET Mail Security.
http://www.eset.com

Loading...