i would like to calculate a value ProcTimeTotalMinutes inside an expression field with a function.
The function will be triggered, but the result will not be displayed.
Firstly, when posting code in the forum, please can you use the preformatted text </> button. It really helps us with readability, and copying and pasting your code (we donât have to faff about replacing curly quote marks to get things working).
Youâre referencing the value passed to your function as $timestring rather than $cputime which is one problem, but the real problem is that youâre passing TotalProcessorTime to your function and trying to handle it as a String but it isnât, itâs a TimeSpan object which doesnât have a Split() method.
Instead, you should directly access the Hours,Minutes, and Seconds properties of the TimeSpan object. You could do this to fix it: