conditional expression in spreadsheet

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
garya
Posts: 244
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

conditional expression in spreadsheet

Postby garya » Tue Sep 22, 2020 5:30 pm

Probably something stupid, but I can't get the following to work as an expression in a spreadsheet (Mdl, NumWells_A,B are cell aliases):

Code: Select all

= (Mdl == 4) ? NumWells_A : NumWells_B
Do relationals not work in spreadsheets in v 0.18?
If not, do they work in 0.19?

OS: FreeBSD 11.3-RELEASE-p12
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.0.18.4
Build type: Release
Python version: 3.7.8
Qt version: 5.14.2
Coin version: 4.0.0
OCC version: 7.4.0.beta
Locale: C/Default (C)

Thanks,
Gary
drmacro
Posts: 2368
Joined: Sun Mar 02, 2014 4:35 pm

Re: conditional expression in spreadsheet

Postby drmacro » Tue Sep 22, 2020 5:59 pm

Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."

My beginners, written treatise: Learning FreeCAD
chrisb
Posts: 30868
Joined: Tue Mar 17, 2015 9:14 am

Re: conditional expression in spreadsheet

Postby chrisb » Tue Sep 22, 2020 7:34 pm

It works here in 0.19 if I omit the brackets around the condition.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
garya
Posts: 244
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

Re: conditional expression in spreadsheet

Postby garya » Wed Sep 23, 2020 1:04 am

Thanks both for the replies. It appears the parens around the expression screw things up.
I will make a note in the docs.
chrisb
Posts: 30868
Joined: Tue Mar 17, 2015 9:14 am

Re: conditional expression in spreadsheet

Postby chrisb » Wed Sep 23, 2020 6:07 am

There is a pull request concerning expressions from realthunder in the queue, which may fix this. Can somebody who has his branch installed please test this?
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Syres
Posts: 831
Joined: Thu Aug 09, 2018 11:14 am

Re: conditional expression in spreadsheet

Postby Syres » Wed Sep 23, 2020 4:30 pm

chrisb wrote:
Wed Sep 23, 2020 6:07 am
There is a pull request concerning expressions from realthunder in the queue, which may fix this. Can somebody who has his branch installed please test this?
I've tested with ExprCompleter branch and it works with the brackets omitted:

Code: Select all

=Mdl == 4 ? NumWells_A : NumWells_B
OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21652 +28 (Git)
Build type: Release
Branch: ExprCompleter
Hash: a1c4e0c86da1058a8e39f3d67df704ecde654708
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
garya
Posts: 244
Joined: Tue Nov 20, 2018 1:00 am
Location: Ovando, MT, USA

Re: conditional expression in spreadsheet

Postby garya » Wed Sep 23, 2020 6:16 pm

Syres wrote:
Wed Sep 23, 2020 4:30 pm
I've tested with ExprCompleter branch and it works with the brackets omitted:

Code: Select all

=Mdl == 4 ? NumWells_A : NumWells_B
The issue is not without the quotes; it's *with* the quotes