Can Command Options be Dependent on Each Other

I would like to add a Command in my driver's metadata section that has 3 input fields (i) cluster, (ii) attribute, and (ii) value. Fields (i) and (ii) are ENUM type and (iii) is a String.

I would like the choice for (i) to be based on a Map of values, and I would like the choices for (ii) to be based on what was chosen in field (i). The first of these is easy - I use some method to select and sort keys from a set of Map keys. I'm stuck on figuring out if (ii) is possible. In order to do this I would need to be able to access the first choice in a function called for the second set of constraings. That is, is there some way to write a function Map getAttributeConstraints( selected cluster from first choice)

   command "test", [    [name:"cluster*", type:"ENUM", description:"Cluster to be Written To", constraints: (attributeInfo.keySet().collect{ "0x" + HexUtils.integerToHexString( it, 2) }) ],
                    [name:"attribute*", type:"ENUM", description:"Attribute to be Written To ${settings.cluster}", constraints: ( /*  Can I put a function Here based on selected cluster */) ],
                    [name:"value", /* and this gets defined as a normal string field */]]

TTBMK this can't be done in a device driver as the command constraints are locked in at screen build. Apps have a little more leeway if doing similar activities.

Yeah, this is one of those dynamic things you can't do in a driver.

But you can still implement the command (the Groovy method, I really mean) however you want, including only accepting certain values for some parameters depending on the value of other values, overloading the method with different signatures (keeping mind that any enum from the UI is going to be a string), etc., though you may need to document the valid inputs for users. The UI will just only show however you specify the command in the driver metadata.

As mentioned above, you can also, of course, do whatever you want in a dynamic app UI that interfaces with this device if that's a better fit for your goals.

An app would also offer more opportunities for feedback from validation checks, compared to a device details page.