Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I've been working around with triggers and I have run into a problem. Here's the situation: When a new point of data is added, if that value is greater than a certain value then I want to trigger a macro. I also need to use the value (int) of that data point in the script.
Actually when you will add that set expression, then the range of values that the aggregation is going to consider will be limited to those data points that are loaded today
So, lets say 3 data points got in today. So as per your original requirement, if any of the data point is beyond your specified range, then it should trigger a macro.
So, what you will need to do is, first use your SET expression to limit the data range to the 3 points loaded today, and then get the maximum of the three. If the maximum of the three is greater than your specified limit then trigger your next code.
So, essentially your variable should find out the max of the three values loaded today
Did it make sense?
when you say, a new data point is added, how exactly does it get added.
I presume, it will always happen after a reload or a partial reload, right? So then you can always associate your macro to the OnPostReload trigger of your document. The data point could be stored in a variable and then its value could be compared
Or in case if its happening thru a slider bar, then you can associate to a variable change trigger.
would be nice if you can share a sample application.
What I mean by a new data point being added is that I just need it to, OnPostReload, check each new point. I was thinking for each point, set the variable to the field value(Actually, in this case it's an expression including field values) then check in a macro vbscript if it's out of bounds and then perform the actions required (in this case email, but I have that done) if it is. I am having trouble giving the variable a value of an evaluated expression. If I can do that and make sure to check every new point on a reload, I'll be good to go. Edit: Added file
ok.. i kind of got it...
so, I am assuming that every new data point that comes in, is calculated for the latest newly added dimension value.
So if this reference dimension is a date, then you can always use < Dimension = {$(=Max(reference date or year or month)}> in a Set Expression and put that in the definition of that variable OR if that dimension is not numeric or date type, then u may need to create an additional field in the script, using RowNo Or RecNo, and then use this field in a FirstSortOrder function to get the latest loaded dimension value. Then use that within the Set Expression...
I am sure all this is too theoretical unless we work on an example file.
How do I use the variable in my vb script (As a result of the expression it was set to)? I've done "T1 = ActiveDocument.Variables("NextPoint").GetContent().String" but that obviously just gets me a string (the expression) and removing the ".String" makes it not work. If you can tell me how to do that I may be able to find out how to do the rest.
what is the definition of the variable. Try putting an "equal to" sign preceeding the variable definition. e.g. if your variable definition as seen in variable overview is "Max(DimensionName)" then put it as "=Max(DimensionName)"
Okay, thanks. That works but there's 1 more question I have. In order to gain access to all points added on reload (say if it's reloaded daily) would be to just make a variable ={$<Date = {TODAY}>} ? Thanks a lot for all your help.
Actually when you will add that set expression, then the range of values that the aggregation is going to consider will be limited to those data points that are loaded today
So, lets say 3 data points got in today. So as per your original requirement, if any of the data point is beyond your specified range, then it should trigger a macro.
So, what you will need to do is, first use your SET expression to limit the data range to the 3 points loaded today, and then get the maximum of the three. If the maximum of the three is greater than your specified limit then trigger your next code.
So, essentially your variable should find out the max of the three values loaded today
Did it make sense?