Hey
I am using calculated fields to convert inches to cm and vice versa on a lot of different measurements. I am just wondering if I am able to put a variable name when called the methodName so I wouldn't need to create a bunch of methods for each separate one.
Example
"UsrLengthCM": { dataValueType: Terrasoft.DataValueType.FLOAT, dependencies: [ { columns: ["UsrLengthInches"], methodName: "calculateInchesToCM" } ] },
do something like this is what I want
"UsrLengthCM": { dataValueType: Terrasoft.DataValueType.FLOAT, dependencies: [ { columns: ["UsrLengthInches"], methodName: calculateInchesToCM("UsrLengthCM") } ] },
to make it easier when using this.set
Like
3 comments
00:00 Nov 05, 2019
The method will get passed two parameters, the second parameter is the field that triggered the event. You could use something like this:
calculateLength: function(sender, field) { switch(field) { case "UsrLengthCM": // ... case "UsrLengthInches": // ... // etc } }
Not sure if that's something that will help, but thought I'd mention it.
Ryan
18:19 Jun 13, 2024
Ryan Farley,
Thanks Ryan, this is the only thread I have found that highlights the fieldname being passed from the Attribute dependency. V.Useful!
Show all comments