Example Program Drafts

Showing results for 
Search instead for 
Did you mean: 

LabView 2010: Formula String-functions do not support Boolean logic - New Parser implemented


as I recognized there's no common way to parse boolean strings with the parse formular string-functions. Operators like !=, ==, && etc. are not allowed.

The common way to nevertheless have such a functionality is to code it by yourself.

In this document I attached a common boolean parser. It's completely open and you can modify it when you want. It works quite simple. Just create a new object of the Parser class, initialize it and call the parse.vi. Afterwards you can achieve your result by calling the execute.vi of the result combination object.

To make it more simple, here a small introduction with Test.vi:

1) Start Test.vi
2) Insert String
3) Push Run
4) Look at the Boolean result

Strings that are allowed:
- No variables are allowed (I do not need this, because my variables are
resolved before the boolean procedure)
- parsed is from left to right, with brackets () you can change the priorities, of course (see examples)
- operators:
true = true,TRUE
false = false,FALSE
AND = AND, and, &&
OR = OR, or, ||
NOT = NOT, not, !
equality = eq, ==
not equality = ne, !=
less = lt, <
greater = gt, >
less or equal = le, <=
greater or equal = ge, >=

So, this should work (for example):
true || false OR false
!(true && false) || true
(!false AND true) && true

but also:
!(1 + 6 <= 7) && !(6 ne 7)

If you want to test it, tell me afterwards if you find any errors...and
what you inserted to produce an error...
By the way....don't try something like:
sin(5) < 0
That does not work...(mathematical functions are not yet implemented, this is still on the To-Do list). Each mathematical function containing brackets produce a false result!

best regards


Member Fred_V

This is wonderful! Thanks so much!

Fred Visser -- SystemLink R&D -- National Instruments
Active Participant Enrico_Segre
Active Participant

Great job, exactly what I was looking for.

The missing support for variables is not so much of a limitation, since variables can be resolved by string suybstitutions in the formula before parsing. However, whenever the variable changes value, the formula needs to be parsed anew.

I'm testing how I can push the performance, possibly below ms execution time for a small array of formulas. Besides parallelizing and inlining subvis, any suggestion you can give me?

I also find that error parsing is minimal (e.g. "(false (** & 66 %~" is parsed as a correct formula), but that is something I can live with.

Member LVuser1980

Nice work!!! I see this cannot do a text comparison. If that right?

Active Participant Munna232
Active Participant

Hello Bde,

Please give me idea on this.


Active Participant Munna232
Active Participant

Hello Bde,

I got the solution for my issue. I used your logic to my requirement.

But, I found small issue with your logic. I think your logic is not checking syntax of input.

For example:

(TRUE) and (TRUE)) and ((FALSE or FALSE) and (FALSE or FALSE) --- > TRUE.



I’m not sure how it is giving like this. I think we should check syntax of Bool String (before doing logical operation)

Active Participant Munna232
Active Participant

Hello Bde,

I found one more bug.

true or false and false --> false but your logic giving true. If more than two logical functions are exists, it starts from left to right.

It means,

1st: true or false --> result-1 (true)

2nd: result-1 and false--> result-2 (false)

Can you please tell me when your doing version up?

Please respond.

Member bde1982

Hello Munna32,

I am really sorry for the spare responses from my side.

The Boolean project I started about 5 years ago and it is far away from

being working 100%. It was a trial to support boolean logic for a

project of mine which apparently was forgotten in LabVIEW.

Sadly, I did not have the time to completely rewrite the software, which

is actually needed to make it run completely.

And at the moment I am deeply involved with my thesis, so I guess for

the next months it is very hard to find some time for it.

But as soon as there will be changes, I gonna inform you about that,

since I also need the package again in the close future. And with

errors, it should be not usable...

Sorry for the unsatisfying answer,

best regards


Am 16.06.2015 um 04:31 schrieb Munna232:


National InstrumentsCommunity



LabView 2010: Formula String-functions do not support Boolean

logic - New Parser implemented

new comment by Munna232

<https://decibel.ni.com/content/people/Munna232> View all comments on

this document


Member Porter

muParser supports boolean logic. Check out the LabVIEW API here: https://lavag.org/files/file/295-lv-muparser/