03-29-2011 03:28 PM
I caan see how that would work however what does this mean.......expected ')'............? it is an error
03-29-2011 03:36 PM - edited 03-29-2011 03:37 PM
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.
03-29-2011 04:45 PM
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!
03-30-2011 09:29 AM
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
03-30-2011 10:09 AM
as much as I have tried I cannot lose the "expected ')' error."
03-30-2011 10:36 AM
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.
03-30-2011 01:03 PM
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
03-30-2011 01:15 PM
here is the data set,
03-30-2011 01:46 PM
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
03-30-2011 02:04 PM
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.