Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
It is time consuming an confusing to have to re-write every expression when creating a new object. Is there a better way? I know that you can re-use expressions within the same object, or copy and paste them across objects, but what about defining an expression, giving it a name and using it by that name in different objects?
Thanks in advance.
Hasan
Hi,
You could define a variable with the text of the expression, and then substitue the variable wherever the expression is needed.
For example, Let SalesVar='Sum(Sales)'. then in the chart, you could use $(SalesVar) in place of Sum(Sales)
Hi,
You could define a variable with the text of the expression, and then substitue the variable wherever the expression is needed.
For example, Let SalesVar='Sum(Sales)'. then in the chart, you could use $(SalesVar) in place of Sum(Sales)
I put all my commonly used expressions at the top of the script so they are all together and easy to review.
Create them using SET and these then get written out as variables on reload. As Vidyut says, you can then reference the contents using $(varname)
Regards,
Gordon
Great tip gentlemen!
I can't believe I haven't been utilizing this. My current project seems to use the same formulas over and over and I've been retyping them each time.
A variable can also be used to define a reusable Set Analysis expression. I am using a lot of flags, so all of my formulas seem to contain {<Flag={1}>}. You can set up a variable vFlag = '{<Flag={1}>}'. Then in each formula, you can use Sum($(vFlag) Field) in place of Sum({<Flag={1}>} Field). In this example, it's not that much shorter, but with longer Set Analysis expressions, it could be a great time saver. If nothing else, it will reduce the number of curly brackets I have to type!
That's exactly what I was looking for, thanks a lot!
Thanks for this topic. really useable for maintenance