DeltaV Live "undefined" value DVSYS.Read()

Hi Everyone,

how can I solve issue with custom script to read a value DVSYS.Read('TASCHENRECHNER/INPUT_VALUE.CV') from control module. This script is customized on click button of the faceplate. It delivers undefined value to back faceplate and after clicking several times it shows right value. 

Thanks

5 Replies

  • Did you mean DLSYS.Read('TASCHENRECHNER/INPUT_VALUE.CV')?

    Have you tried DLSYS.Read('TASCHENRECHNER/INPUT_VALUE.CV').Value? (I'm not sure exactly what .Value does. Still looking for clarity on when and why to use it.)

    For a one time read like this, BOL recommends to use DLSYS.CondRead('TASCHENRECHNER/INPUT_VALUE.CV', 0).Value. this is like the {Not_Config_OK} extension in Operate and if the path does not exist, the default value is used. It should retry the read. This might be your ticket.

    I recently discovered that in Graphic Studio, using DLSYS.Read or DLSYS.CondRead in a "Parameter Expression" causes a verify warning, but if used in Graphics Expression field, there is no issue with Verify. At run time, this does not seem to matter and the read will be successful. In a parameter expression you would use DLSYS[ ] syntax to avoid a verify warning.

    Andre Dicaire

  • You should by default use DLSYS object functions in DeltaV Live (like Andre said).  Per Graphics Studio Help (F1 help) :

    Restriction The DVSYS object works only with parameter paths that use DeltaV Operate parameter field path syntax; therefore, the DVSYS object should be used only with graphics configuration that has been converted from DeltaV Operate. For configuration that has been created in Graphics Studio, the DLSYS object and its functions should be used.

    If you are reading a value where the module will always exist (ie not a phase), you can use DLSYS[<DeltaV Live parameter path string>] to get the information.  As an example here is a text box looking at DLSYS["BJM_TEST/INPUT.CV"] (a custom module I created):

    DLSYS Configuration for text box

    Demo

    GIF of input text changing

     I think that the .value ending for the DLSYS.Read() function is dot notation access point for TypeScript. 

    There are other "dot" (.) properties that can be observed via the F12 debugger on a graphic. Note: you need to enable debugger on a per graphic basis. 

    The debug console isn't always 1-to-1 w/ scripts that can be created in Live but usually it's pretty close.  Cheers!

    Debugger and dot value notation

    Ben Merryman

  • In reply to Ben Merryman:

    In addition to using the ".Value" if you are trying to read in a script (Display Interaction OnOpen, Button Custom Script, etc) you have to use an Async function (ReadAsync and WriteAsync) with await.

    var strVal = await DLSYS.ReadAsync('TASCHENRECHNER/INPUT_VALUE');
    if(strVal != null)
    {
    use strVal.Value in your script
    }
  • In reply to Matt Stoner:

    Hi Matt,

    I am trying to read the value and update the Label of the text. Sometimes I get the text "undeifined". This is like: 

    Dsp.Ergebnis.Label = (await DLSYS.Read('TASCHENRECHNER/OPERAND1.CV').Value) + " * " + (await DLSYS.Read('TASCHENRECHNER/INPUT_VALUE.CV').Value) + " % ".

    If the display stays opened for a long time, I dont get the text "undeifined". But if the display opened for a first time, it needs a little time to return normal values in the text, or I need to make some operations to update the text with pressing buttons.

  • In reply to Matt Stoner:

    The ReadAsync is what I was thinking. Sorry for the confusion. The CondRead is for when the parameter may or may not exist, and a default value is passed when the parameter does not exist.

    Thanks Ben for the information on the Dot notation.

    Andre Dicaire