Read values from a Named Set

Does anyone know of a way to read the values from a Named Set into a VB array or some other technique for addressing the values individually?

6 Replies

  • I assume you're talking about doing this in DeltaV Operate? You can read the ".A_OPSEL" (DVSYS.module/parameter.A_OPSEL) field for the named set parameter to get a comma-separated list of the string entries, and I think ".A_OPSELVAL" gets you a comma-separated list of the numeric entries. To get them into an array, you'd have to process the lists from those two reads.
  • The below logic will give you the user selectable string values into a string array:

    On Error GoTo ErrorHandler
       Dim strValues() As String
       Dim strSelections() As String

       strValues = frsReadValue("DVSYS.MODULE/NS_PARAM.A_OPSEL", lError1, "", False)
       strSelections = Split(strValues, ",")

    Exit Sub
    ErrorHandler:
       frsHandleError

    You can get the non user selectable string and number values but it involves parsing a text file which I wouldn't recommend doing unless it really has to be done. You can just use the string and write to A_CV field of nameset parameter and not need the number.

    Yes the number values are in OPSELVAL field of the named set parameter if you want to do the extra logic to use this but it's unnecessary I think.

  • In reply to Matt Stoner:

    Thanks Matt! That worked perfect. By the way, where would I look to find documentation for OPSEL and OPSELVAL?
  • In reply to MCrisler:

    Perfect! Thank you! How did you know about these? Is there documentation somewhere?
  • In reply to Robert Perry:

    Unfortunately OPSELVAL isn't documented at all and the OPSEL is documented but not real good as it only talks about if Configurable, Readable and Writeable in BOL at this location:

    Configuration->Function Blocks->General information about function blocks->Function block parameters and fields

    Use WATCHIT app and type in the path to a named set parameter to see what the fields hold. You can also use OPCWATCHIT but the fields aren't exposed so you will need to browse to CV and then use the TypePath to change to OPSEL or OPSELVAL

  • In reply to Matt Stoner:

    This tip is a goldmine for me. Many thanks!