11-19-2018 05:10 PM
When using the calculation manager, how do I output the calculation string to a channel property? My final goal is to include the calculation string as a report element.
11-20-2018 01:58 PM
Hi RussellSenior,
What exactly do you mean by "Calculation string"? Do you mean the result of the calculation cast to a string data type, or the formula itself? I've included instructions for the first case below.
If you click the "Advanced>>" button in the calculation manager when adding a new calculation, you'll get to the script view. From here, you can take the result of your calculation and set one of your channel properties to that value using the document below for reference:
Assigning Data Set, Group, and Channel Properties with a Script
http://zone.ni.com/reference/en-XX/help/370858N-01/procauto/procauto/procauto_channel_change_propert...
11-21-2018 09:53 AM
i'm looking for the formula string that is passed to the calculate function. I've attached what I'm looking for from the calculation manager. If I scripted the calculation myself, it's trivial to add the calculation string into a channel property. I'm not sure how to do it in conjunction with the calculation manager.
The bottom line of what I am looking for, I want to be able to display the calculation I used in a report. So, if I am displaying "Channel A", I want to show how "Channel A" was calculated, for example: "ChannelA = ChannelB*m + b"
11-26-2018 03:30 PM
Hi RusselSenior,
I've linked documentation for DIAdem's calculation manager below:
Calculation Manager
http://zone.ni.com/reference/en-XX/help/370858N-01/dlgmaths/calc_formular_dlg/dlgcalcaddandedit_adva...
There are 2 properties that might be relevant here (I say "might" because my computer is currently in the process of uninstalling/reinstalling DIAdem because I need to move it to a different hard drive, so I can't test to confirm right now): Description and Calculation Script.
Description is what it sounds like: It's the test in the description box of the manager. If you were to put the formula here in addition to the formula box, you could use this property to update your channel properties.
Calculation Script is also (mostly) what it sounds like: it's the script that actually holds your calculation. What I'm unsure of here until I test it is whether VBScript will treat it like a string if you try to assign this value to a channel property.
Either way, the data from these properties can be assigned to a channel property using the methods in my previous reply.
11-26-2018 03:57 PM
Thanks for that. I poked around there before, but I couldn't find what seemed useful. This help file shows the "basic" layout of the calculation manager, and shows the formula input, but there does not seem to be a way to access that.
I did find a way to get the entire calculation script:
calculationset.CalculationGroups.Item(1).Calculations.Item(1).CalculationScript
This will give me the entire calculation script, not just the formula. I could do some string gymnastics on it to get what I want. Not ideal, but I guess it's one way.