DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you do an average of only ONE channel in analysis?

Solved!
Go to solution

I caan see how that would work however what does this mean.......expected ')'............? it is an error

0 Kudos
Message 11 of 33
(5,612 Views)

You probably left off a closing parentheses character.  You will need one, curved bracket closing parenthese character to match each opening parenthese character.  Try counting the number of open characters in your code ---> (  and the number of close characters --> ).  I'll bet you won't get the same number.  Let me know how that goes.

Regards,

Shawn S. | NIC
Instrument Driver/IVI PSE
National Instruments
0 Kudos
Message 12 of 33
(5,609 Views)

last question for the day.....no need to get back right now. The answer for averaging in text continues with the error ")" expected. Why does an expression work in the calculator but not in a script?

 

"example"      Ch("[1]/Result") = Round (CMax(86))

 

thanks for your help today!

0 Kudos
Message 13 of 33
(5,604 Views)

Hi shredderjohn,

 

It's working in the calculator and not the script because you're using calculator syntax:  the "Ch()" syntax only works in the channel calculator and find functions.  Now you can execute both of those from a script, using ChnCalculate() and ChnFind(), but otherwise you need to use VBScript syntax.

 

I've already posted the @@ expression for use in a REPORT layout.  How about if you explain what you want to do with the average in the script?  I have seen nothing in your posts so far that suggest that the channel calculator is needed-- I'd forget that for now.  We cold do a variety of things with scripting, but so far I don't know what your needs/goals are.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 14 of 33
(5,597 Views)

as much as I have tried I cannot lose the "expected ')' error."

0 Kudos
Message 15 of 33
(5,594 Views)

Brad,

It really is a simple task we are attempting. We bring in a .csv file that is made up of .5 second observations of mostly hydraulic pressures. The total time of the file is usually 6-8 hours. I do a 2d graph of the system pressure, a high pressure value text and an average value text, thats it! The averaging has been the issue (as you know). I get an average very easy but it comes in with about 6 digits below zero. That is not needed. All I really need is a whole digit integer displayed for the average figure.

0 Kudos
Message 16 of 33
(5,591 Views)

Hi shredderjohn,

 

Since you didn't send me a data set, all I can do is repeat my previous recommendation for the @@ expression-- here's the one for the maximum field in your report:

Maximum: @@Round(Data.GetChannel("[1]/DFR System Pressure").Properties("maximum").Value)@@

 ... and here's the one for the average field in your report, both for the first sheet in your multisheet report:

Average = @@Round(Data.GetChannel("[1]/DFR System Pressure").Properties("ResultStatArithMean").Value)@@

I'm also attaching the mock TDR file I created that works with the dummy data I had on hand,

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 17 of 33
(5,585 Views)

here is the data set,

0 Kudos
Message 18 of 33
(5,583 Views)

Hi shredderjohn,

 

That's better, thank you for the data set.  I was able to embed the CMax() function to calculate the maximum as well as the CCh() function to calculate the average, so this makes the expressions simpler and also avoids the need to do the average calculation in a script.

 

Now you just need to copy this page to your other sheets and change the channel references in the graph and the three text boxes to the target channel for that page.  No VBScript needed.  Just make sure you save the TDR file afterwards so you don't lose all your work.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 19 of 33
(5,580 Views)

The destination: Properties("ResultStatArithMean"), does not exist in the properties of that channel. I have been trying to create a new property for it to go to but have yet to find a way. Seems thats all it would need.

0 Kudos
Message 20 of 33
(5,579 Views)