Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

How to use 'Options' to validate passed-in service parameters

Code example


Options DoSomething.thing.options = 'thing 1', 'thing 2', 'thing 3', 'thing 4'
Service DoSomething(thing=DoSomething.thing.options)

// Validate param
* How to make sure `thing` is one of `DoSomething.thing.options`

Response = 'Did ' : thing

end service

Question

Is it possible to access the values defined by an "Options" statement at runtime so they can be used to validate a service argument?

In other words, can I validate that thing is one of the values from "DoSomething.thing.options", without manually duplicating the same list of values inside the service?

Comments

  • edited 3:50PM
    There is no built-in feature for this but you can write your own solution. Service names, arguments, and related option values are stored in the SYSENV table with this key ID structure: SRP_EDITOR_METADATA*{ProcedureName}*{AppID}

    Fields 7, 8, and 9 are associated:
    • Field 7 contains an @VM delimited list of services.
    • Field 8 contains an @VM/@SVM delimited array of arguments.
    • Field 9 contains an @VM/@SVM delimited array of OPTION names.
    Fields 10, 11, and 12 are associated:
    • Field 10 contains an @VM delimited list of OPTION names.
    • Field 11 contains an @VM/@SVM delimited array of OPTION values.
    • Field 12 contains an @VM delimited list of Boolean flags indicated if the values are literals.
  • Oh this just what I needed, perfect.

    Thank you!
Sign In or Register to comment.