# Create callback for subcontainer

**URL:** <https://dmap-community.ductus.global/t/create-callback-for-subcontainer/941>\
**Category:** YANG\
**Created:** [January 11, 2017, 8:08am UTC](https://dmap-community.ductus.global/t/create-callback-for-subcontainer/941 "2017-01-11T08:08:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![InbalAmram](https://avatars.discourse-cdn.com/v4/letter/i/0ea827/32.png) [@InbalAmram](https://dmap-community.ductus.global/u/InbalAmram)\
**Post date:** [January 11, 2017, 8:08am UTC](https://dmap-community.ductus.global/t/create-callback-for-subcontainer/941/1 "2017-01-11T08:08:47Z")

</div>

Hi,

We have in our yang model container A and sub-container B.  
When the sub container is being configured, we don’t receive the callback “create” for that since it is not a list (is a leaf). The “create” is received only to the container.  
We would like to create that leaf in our external DB only when B is configured and not when A.  
Is there a way to define the sub-container B, so we will receive “create” callback when it is configured, and not just set\_elem?

thanks  
Inbal

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [January 11, 2017, 9:43am UTC](https://dmap-community.ductus.global/t/create-callback-for-subcontainer/941/2 "2017-01-11T09:43:10Z")

</div>

Please, can you paste sample of the data model and mark where callback is attached?  
I’m not sure if I understand where mentioned `leaf` is located in the `containers`.

From ConfD User guide (The external database API -\> 7.4. Data Callbacks):

```nohighlight
create() - This callback creates a new list entry. In the case of the smp.yang module above, this function needs to create a new empty "server" entry. Once the entry is created, it will be populated with values through a series of calls to set_elem().

remove() - This callback needs to remove an entire list entry and all its subelements.

set_elem() - This callback sets the value of a leaf.

```
