https://bugs.kde.org/show_bug.cgi?id=525178
Bug ID: 525178
Summary: Column formula: a variable named like a built-in
function or constant is rejected (or silently
shadowed) without any explanation -- display
appropriate hint
Classification: Applications
Product: LabPlot2
Version First latest
Reported In:
Platform: Microsoft Windows
OS: All
Status: REPORTED
Severity: normal
Priority: NOR
Component: User Interface
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Depends on: 525066
Target Milestone: ---
When composing a spreadsheet column formula, a variable whose name collides
with a built-in
symbol cannot work, but the user is never told why. Depending on what the name
collides with,
one of two things happens:
* built-in FUNCTION [1]
The expression cannot parse, the formula field turns red, 'Apply' stays
disabled - and no
message is shown anywhere. The variable name field is NOT highlighted and its
tooltip stays
empty.
* built-in CONSTANT [2]
The expression parses and is reported as correct, so the formula field stays
white while only
the variable name field is highlighted. The variable is not resolved to the
selected column:
wherever such a formula is evaluated (a project opened with it, or a
recalculation triggered by
Auto-Update), the column is computed FROM THE CONSTANT, producing wrong data
with no warning.
This is easy to hit in practice: 78 built-in functions have names of 1-2
characters and 46
constants have names of 1-3 characters (as of master 61931ced3), which is
exactly what one uses
for physical quantities (D for diameter, F for force, E for modulus, P for
pressure, in/ft for
units...).
STEPS TO REPRODUCE
Attached MWE.lml contains two spreadsheets and a chart; open it and select, in
the spreadsheet 'Wear scar', the two formula columns. Both compute ISO 20808
formula (2) for the wear volume of a ball, both take A and B from 'Wear scar'
and the ball diameter from 'Ball parameters'. The only difference is the NAME
of the third variable.
1. Select column 'V ok (mm^3)' - formula pi*A^3*B/(32*Dball), variables A, B,
Dball. Valid, Apply enabled.
2. Select column 'V bug (mm^3)' - formula pi*A^3*B/(32*D), variables A, B, D.
3. Rename the variable 'D' to anything else (e.g. Dball) - the formula
becomes valid at once.
Constant variant: rename the variable to 'pi' and use it in the expression. Now
the name field IS highlighted, but the formula field is not, and the formula
silently evaluates pi.
OBSERVED RESULT
Step 2: the formula field turns red, 'Apply' is disabled, the variable name
field 'D' stays white with an empty tooltip, and no message explains what is
wrong. Nothing on screen mentions that 'D' is a built-in name.
EXPECTED RESULT
The offending variable name field is highlighted and a message states which
built-in symbol the name collides with, e.g.:
***
'D' is the name of the built-in function D(k; phi) (Legendre form of incomplete
elliptic integral D) and cannot be used as a variable name.
***
[1] (D, F, E, P, Ai, J0, L1, Ln, Si, W0, ...) - full list of the built-in
functions:
https://invent.kde.org/education/labplot/-/blob/61931ced3/src/backend/gsl/functions.cpp
'D' is defined at line 437:
https://invent.kde.org/education/labplot/-/blob/61931ced3/src/backend/gsl/functions.cpp#L437
[2] (pi, e, G, au, in, ft, ms, day, ...) - full list of the built-in constants:
https://invent.kde.org/education/labplot/-/blob/61931ced3/src/backend/gsl/constants.cpp
'pi' is defined at line 67:
https://invent.kde.org/education/labplot/-/blob/61931ced3/src/backend/gsl/constants.cpp#L67
Release build 5d639e3
Aug 28 2026, 08:28:40
System: Windows 11 Version 25H2
Locale: Polish, Poland
Number Format: 1,000.01 (Updated on restart)
Architecture: x86_64-little_endian-llp64
Kernel: winnt 10.0.26200
Referenced Bugs:
https://bugs.kde.org/show_bug.cgi?id=525066
[Bug 525066] Mask spreadsheet cell value does not recalculate column statistics
when bar chart contains error bars
--
You are receiving this mail because:
You are watching all bug changes.