# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Formula Node is not working

hi,

Im trying one equation in formula node but its showing error.  The  error is attached.

the equation  is   z=(500)/[(2^x)*(y+100)

thank you

Message 1 of 10
(509 Views)
Solution
Accepted by topic author newmemeber123

## Re: Formula Node is not working

Just wondering why you might need a formula node when you can achieve the same using LabVIEW primitives as shown below,

Santhosh
Soliton Technologies

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 10
(497 Views)

## Re: Formula Node is not working

What happens if you replace the "[]" with "()"?

(Still, I agree that there is not need for a formula node to do all this 😄 )

@newmemeber123 wrote:

The  error is attached.

Message 3 of 10
(495 Views)

## Re: Formula Node is not working

You cannot use a bracket ([ or ]) in a formula node.  You need to use the parenthesis, which can be nested.

Just to be somewhat controversial, I sometimes prefer to use a formula node when math gets "weird".  It just seems more natural to read to me.  This is only when the math gets more complicated beyond a few nodes and variables are reused.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 10
(492 Views)

## Re: Formula Node is not working

@crossrulz wrote:

You cannot use a bracket ([ or ]) in a formula node.

Yes, you "can", but they have special meaning and are used for array indices, for example. 😄

@crossrulz wrote:

Just to be somewhat controversial, I sometimes prefer to use a formula node when math gets "weird".  It just seems more natural to read to me.  This is only when the math gets more complicated beyond a few nodes and variables are reused.

Except that a few minutes later, we need the same operation where the inputs/outputs are arrays. Graphical code will adapt automatically, while the formula node would need extra work. 😄

Message 5 of 10
(481 Views)

## Re: Formula Node is not working

@altenbach wrote:

@crossrulz wrote:

You cannot use a bracket ([ or ]) in a formula node.

Yes, you "can", but they have special meaning and are used for array indices, for example. 😄

I knew I was going to get called out for that shortly after I hit "Post".

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 10
(478 Views)

## Re: Formula Node is not working

@newmemeber123 wrote:

Im trying one equation in formula node but its showing error.  The  error is attached.

The error description includes a hint:

Error on line 1 is marked by a '#' character: "z=(500)/[#(2**x).."

So LabVIEW tells you that there is a problem with the bracket.

Message 7 of 10
(449 Views)

## Re: Formula Node is not working

@ThomasHenkel wrote:
So LabVIEW tells you that there is a problem with the bracket.

One of the reasons I don't use the formula node is that the error messages are so cryptic.

Here, the problem is not with a "missing semicolon" as described and it is never really obvious (at least to me) if the "#" is to the right or left of the problem. 😄

Message 8 of 10
(443 Views)

## Re: Formula Node is not working

@altenbach wrote:
and it is never really obvious (at least to me) if the "#" is to the right or left of the problem.

I'm 98% sure, the '#' is always after the character that caused the error 😉

Message 9 of 10
(439 Views)

## Re: Formula Node is not working

@ThomasHenkel wrote:

@altenbach wrote:
and it is never really obvious (at least to me) if the "#" is to the right or left of the problem.

I'm 98% sure, the '#' is always after the character that caused the error 😉

Yes, after successfully correcting many errors we learn from experience that that's true!

The statement "Error on line 1 marked by a '#' character" is just not concise enough.

If I were the compiler, I would probably place the # before the problem, delineating the border between good and bad code , i.e. "OK, I was able to successfully parse up to here, but I stumbled going forward". 😄

Good thing we have a graphical code alternative. 🙂

Message 10 of 10
(428 Views)