From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parse formula and mod/rem

Solved!
Go to solution

Unfortunately, I cannot pull in external code libraries like that (Company policy).  If it were up on the package manager without a GPL like license, I could.  I'm also stymied with GPower... Trying to pull in paid libraries is a huge exercise (It took me a full year just to get LabView approved).  So I'm stuck with the built in libraries and features of the LV Full license.

0 Kudos
Message 11 of 20
(941 Views)

@xl600 wrote:

Unfortunately, I cannot pull in external code libraries like that (Company policy).  If it were up on the package manager without a GPL like license, I could.  I'm also stymied with GPower... Trying to pull in paid libraries is a huge exercise (It took me a full year just to get LabView approved).  So I'm stuck with the built in libraries and features of the LV Full license.


We hear that a lot. A fun excercise for your financial controller would be to add the total cost of not purchasing a license to a toolkit like Expression Parser (or any similar tool), and see if that number exceeds the license price. For starters you wouldn't be wasting your time with this thread 😉

CLA, CTA, CLED & LabVIEW Champion
0 Kudos
Message 12 of 20
(936 Views)

That argument falls on deaf ears here.  And it's getting much worse.  I guess it keeps me employed (Until the company goes out of business).

0 Kudos
Message 13 of 20
(934 Views)

I understand, and I'm not offended in any way. I wasn't pitching EP, my idea was that the user guide to EP might be worth browsing through in any case. And that's free.

CLA, CTA, CLED & LabVIEW Champion
Message 14 of 20
(930 Views)

My solution has been to use muParser: http://beltoforion.de/article.php?a=muparser&hl=en&p=features

Open source, MIT License. It doesn't support mod() out of the box but you can easily add it.

 

I've released a muparser API for LabVIEW over on LAVA: https://lavag.org/files/file/295-lv-muparser/

 

Of course, I would prefer to use GPower's expression parser because it's faster, has more features, supports multiple data types, and is fully implemented in GCode. But for most projects muparser does the trick.

0 Kudos
Message 15 of 20
(828 Views)

@altenbach wrote:

Here is the list of differences. Yes, "mod" is not supported.


ok.. 5 years on, using LabVIEW 2020 SP1. The help page for 2012 is still there and the help pages for anything else haven't been updated.
Documentation is appalling and goes in circles for Parsing formulae.

curiously, I can't get mod to work.

However... if I load the Formula express VI and type: mod(2,4) then it tells me that I have a valid variable - so either the express VI is broken or I haven't found the correct code.
I've already worked out that the express VI changes ** to ^ in the formula string under the hood before it passes it onto the "Parse Formula String.vi" in order for it to be a valid formula.

I'm expecting something similar in the express VI for mod, rem, max, and min as my syntax checks on my new dialog VI are failing.
Any chance anyone with superpowers can peek under the hood of the express VI? (or does anyone know anything about this)?

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 16 of 20
(597 Views)

Hi James,

 


@James_W wrote:
Any chance anyone with superpowers can peek under the hood of the express VI? (or does anyone know anything about this)?

You can convert the ExpressVI to an ordinary subVI (using its context menu) and look for yourself. The ExpressVI scripts a formula node - and your mod() function is supported within the formula node…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 20
(590 Views)

@GerdW wrote:

Hi James,

 


@James_W wrote:
Any chance anyone with superpowers can peek under the hood of the express VI? (or does anyone know anything about this)?

You can convert the ExpressVI to an ordinary subVI (using its context menu) and look for yourself. The ExpressVI scripts a formula node - and your mod() function is supported within the formula node…


Argh!!!
so If I don't know what the formula is going to be I can't use it? as I can't use scripting (only the parse) functions at runtime. 😫

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 18 of 20
(581 Views)

Hi James,

 


@James_W wrote:
so If I don't know what the formula is going to be I can't use it? as I can't use scripting (only the parse) functions at runtime. 😫

When you want to change the formula at runtime you cannot use the ExpressVI at all. Point.

You can configure the ExpressVI only at edit time!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 20
(576 Views)

For runtime parsing and evaluation, have you taken a look at our Expression Parser toolset?

 

https://gpower.io/en/products/expression-parser/

 

There is a comprehensive user guide, take a look at the first few pages to see what it is and how it compares to the options shipping with LabVIEW. I wrote it, so let me know if you have any questions.

CLA, CTA, CLED & LabVIEW Champion
0 Kudos
Message 20 of 20
(568 Views)