# Can't use "must" statement under for grouping

**URL:** <https://dmap-community.ductus.global/t/cant-use-must-statement-under-for-grouping/4250>\
**Category:** YANG\
**Created:** [November 3, 2022, 6:34am UTC](https://dmap-community.ductus.global/t/cant-use-must-statement-under-for-grouping/4250 "2022-11-03T06:34:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chulian](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@chulian](https://dmap-community.ductus.global/u/chulian)\
**Post date:** [November 3, 2022, 6:34am UTC](https://dmap-community.ductus.global/t/cant-use-must-statement-under-for-grouping/4250/1 "2022-11-03T06:34:12Z")

</div>

The following is my test yang model for “must” statement.

```auto
grouping test_group {
    container test {
      leaf test_paramater {
        type empty;
      }
    }
  }
  list test {
    key name;
    leaf name {
      tailf:info "Unique service id";
      tailf:cli-allow-range;
      type string;
    }

    uses ncs:service-data;
    ncs:servicepoint test-servicepoint;

    leaf flag {
      type boolean;
    }
    uses test_group {
       must "../flag = 'true'"; //it works fine with "when" statement
       }
    }
  }

```

I want to use the “must” condition for the grouping using. But it throws the compile error with “yang/test.yang:48: error: unexpected keyword ‘must’”.

It works fine when I change the statement to “when”, but I want to know is there any particular limitation can not use “must” for grouping?

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [November 3, 2022, 10:03am UTC](https://dmap-community.ductus.global/t/cant-use-must-statement-under-for-grouping/4250/2 "2022-11-03T10:03:15Z")

</div>

See [RFC 7950: The YANG 1.1 Data Modeling Language](https://www.rfc-editor.org/rfc/rfc7950#section-7.13.1) under “The uses’s Substatements”  
You cannot have a “must” statement in a “uses” statement according to the YANG RFC. Makes sense when you read the “uses” statement definition.

---

<div class="post-metadata">

**Author:** ![chulian](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@chulian](https://dmap-community.ductus.global/u/chulian)\
**Post date:** [November 3, 2022, 10:23am UTC](https://dmap-community.ductus.global/t/cant-use-must-statement-under-for-grouping/4250/3 "2022-11-03T10:23:57Z")

</div>

Thanks for your quick response! It make sense!
