Live return length of PV

I want to have a variable function return the length of a PV, it would be Module/AI1/PV. I want to use the size of the value as a way to modify some size and spacing for instance if the value is 1.01.. compared to 43,000 I will have different spacing needs. 

I can't seem to get an expression to return the value i'm looking for. I'm wondering if there is a method available like .length. 

I'm using a number funciton with a Script Conversion Type, I'm passing Tag and Path to the function as strings. My script is something like:

return DLSYS.Read(Tag + '/' + Path + '.CV').length

I don't know if i'm even in the ballpark here

  • In reply to Matt Stoner:

    So, my first issue was passing Path... i needed to add the double quotes around it so it was a proper string.. In the end i went a little different route and decided I didn't want the length to be constantly updating because the units and PV would keep moving on the screen if it was bouncing between like 9.9 and 10.. or if it was going negative and positive. So, I am checking the scale parameter, since EU100 is going to give me the largest number i can expect. Also, because that number may or may not have decimal places, i trim the decimals and also convert the number to an object. Once i convert the number to an object with toFixed... i am able to use the .length property. the number passed to 'toFixed' is the number of decimal places you want. Actually, I think the function might create a string not an object. Either way... length property was available where it wasn't with the number being returned by the .Value property.

    Then I just check my EU0 to see if i can possibly expect a negative value (if i'm reading pressure).. Then i can account for an extra space.

    Now I can work on updating my GEM with the dynamic spacing based on this variable. Not sure how i'm going to do that though.

    let scale100 = DLSYS.Read(Tag + '/' + FB + '/' + Scale + '.EU100');
    let scaleDec = DLSYS.Read(Tag + '/' + FB + '/' + Scale + '.DECPT');
    let scale0 = DLSYS.Read(Tag + '/' + FB + '/' + Scale + '.EU0');

    if (scale0.Value < 0) {
    return (scale100.Value.toFixed(0).length + scaleDec.Value + 1);}
    else {
    return (scale100.Value.toFixed(0).length + scaleDec.Value); }