0
Not a bug

QCode bug: 'result' not in pulldown menu

Dave Minerath 5 years ago in IQANdesign updated by Ulrik Zakariasson (Software development) 5 years ago 6

When I try to use QCode and start typing


result:=


The pulldown menu only shows

<space>:=

after I type the first few chafracters.


So, if I type


re


The menu shows

:=


so I click on it, and the Qcode line ends up looking like this:


re :=(Warning Code Valve 3 GPIN>0)and (Warning Code Valve 3 GPIN<>12 and Warning Code Valve 3 GPIN<>15 )

instead of

result :=(Warning Code Valve 3 GPIN>0)and (Warning Code Valve 3 GPIN<>12 and Warning Code Valve 3 GPIN<>15 )

This worked fine in version 4.00, and seems to be new to 4.01.

Answer

Answer
Not a bug

Ok, I see. Some channel types don't use the

Result :=

syntax. Instead they use Qcode commands. The event counter is one of those. Look at the IQ hint for each channel type to see its Qcode syntax. This is from the IQ hint for event counter:

The event counter channel is controlled by using Qcode commands. The following commands are available:

    • QIncrease increments the value of the channel.
    • QDecrease decrements the value of the channel.
    • QReset resets the channel value to the value defined by the property Reset value.

So instead you would type something like this:

if (Warning Code > 0) and (Warning Code <> 12) and (Warning Code <> 15) then
  QIncrease
endif

You can read more about it in the user manual, chapter 4, especially page 93 which talks about Qcode commands.

As an additional note, the error returned with first line with the re:= returns an "Expression not Used" error.


The line with "result:=" returns an long error calling out an unexpected break, //, etc.


Under review

Hi Dave,

I cannot reproduce this problem. In 4.01 I get this:



Can you send screenshot, or maybe I don´t understand your problem?

This screen shot shows what I see when trying to use Qcode to trigger an event counter.


I am entering in Qcode to trigger a counter event. When I am in IQAN 4.00, and start typing "result" in the Qcode box, the popup menu shows "result" as expected and the Qcode is shown to be valid.


When I load the project into IQAN 4.01, the previously valid Qcode no longer works. When I try entering new Qcode, as I start to type "result" in the Qcode box, "result" is never an option.


I don't get the error when I try a different math channel, like in your example. It seems like the error is limited to the event counter.

Answer
Not a bug

Ok, I see. Some channel types don't use the

Result :=

syntax. Instead they use Qcode commands. The event counter is one of those. Look at the IQ hint for each channel type to see its Qcode syntax. This is from the IQ hint for event counter:

The event counter channel is controlled by using Qcode commands. The following commands are available:

    • QIncrease increments the value of the channel.
    • QDecrease decrements the value of the channel.
    • QReset resets the channel value to the value defined by the property Reset value.

So instead you would type something like this:

if (Warning Code > 0) and (Warning Code <> 12) and (Warning Code <> 15) then
  QIncrease
endif

You can read more about it in the user manual, chapter 4, especially page 93 which talks about Qcode commands.

That would do it...I think I was thrown off a little as the result:= syntax was valid in 4.00, but not in 4.01.


Thanks for the help. And speaking of the manual, I really like the help file being a regular PDF version of the manual. It makes it quite easy to have the file open on a tablet for ready reference while programming on the machine with a single-screen laptop.

+1

It may be worth noting that the "result := " syntax was valid in 4.00, but did not make the counter increase. It just created a local variable (called Result) and assigned a value to it.