Summarization function
Forums
In the summarization function IDEA wants to know what statistics functions to use. When all are selected the code is as follows: task.StatisticsToInclude = SM_SUM + SM_MAX + SM_MIN + SM_AVERAGE + SM_VARIANCE + SM_STD_DEV
I created check boxes in a dialog menu so the user can select the statistics function they want to use. The check boxes are set as boolean, but i added a If function that when a statistic function is selected (example sum) a variable (sting) is set with SM_Sum and if not it is set to "".
The problem i have is that the script first need to determine what functions are selected and then build the code line for the task.StatisticsToInclude line. How do I let IDEA build a line so that in front of every second statistic function a "+" is added?
it works, thanks. For my
it works, thanks. For my knowlegde: IDEA knows every numeric combination to identify which functions it need to use? Because i thought it would only work with text as SM-SUM. And a more general question is there a book on how to learn to program this kind of language?
IDEA doesn't know the
IDEA doesn't know the combination but what you are actually doing is setting a bit in an 8 bit binary code. It is a trick to use less memory to do things like this. So SM_SUM is 2 (setting the first bit), SM_MAX is 4 (this sets the second bit), SM_MIN is 8 (setting the third bit) and so on. So the code looks to see what bits have been set to decide which stats to use. So the number six is represented by selected the first two bits. The number four would only be the second bit and so on. Hopefully that makes a bit of sense. The only IDEAScripting book that is available the "Mastering IDEAScript the definitive guide"
i thought if you collect the
i thought if you collect the selection by the user in bit code, then and after the script is finished you can show the user in text what he selected. Because with flat text if a option is not used it will create a blank in the message line. I first thought to make an array of it and then remove the blanks and unbound it. But i can't get the remove blanks function get te work with that. So i thought this is maybe an easier method.
Hi Robert,
Hi Robert,
You can use something like this. Each of the items such as SM_SUM, SM_MAX are actually integers that you can add together. You could use the numbers also but you use the constants as it makes it easier to read. So in this instance you just add them together and set the task.StatisticsToInclude to the result. Here is an example, you would set task.StatisticsToInclude= iStatsToInclude: