Conditionally hide list entries on child node presence

Hello,

Suppose I have the following YANG model:

list someList {
  key "name";
  leaf name {
    type nameType;
  }
  
  container someContainer {
    choice aChoice {
      case caseOne {
        list choiceListOne {
          key "name";
          leaf name {
            type nameType;
          }
        }
      }
      case caseTwo {
        list choiceListTwo {
          key "name";
          leaf name {
            type nameType;
          }
        }
      }
    }
  }
}

Now I want to hide entries (in show running-config) of ‘someList’ if its ‘choiceListOne’ or ‘choiceListTwo’ (indirect) child node has the same key ‘name’ as itself.
So, in following configuration someList entry ‘n1’ should be hidden while entry ‘n2’ should be shown in ‘show running-config’:

someList n1
  someContainer choiceListOne n1
someList n2
  someContainer choiceListTwo x1

Has anyone some idea to achieve this?

Did you try to use YANG when statement?