# Set priority to field

**URL:** <https://dmap-community.ductus.global/t/set-priority-to-field/1597>\
**Category:** General\
**Created:** [October 18, 2017, 12:58pm UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597 "2017-10-18T12:58:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![evyatar](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@evyatar](https://dmap-community.ductus.global/u/evyatar)\
**Post date:** [October 18, 2017, 12:58pm UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/1 "2017-10-18T12:58:54Z")

</div>

Hi,

I have list named “neighbors” and it has key named “neighbor-address”.  
In addition this list have another “must” attribute named “peer-group” which is leafref.

I would like that after create of new item in the list the first set\_elem will be to the attribute “peer-group” which is must.

How can I do it?

Thanks,

Evyatar

---

<div class="post-metadata">

**Author:** ![nabil](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@nabil](https://dmap-community.ductus.global/u/nabil)\
**Post date:** [October 18, 2017, 5:19pm UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/2 "2017-10-18T17:19:14Z")

</div>

This is not possible.  
you should not make your implementation dependent on a certain order.

But, in your case, you can always read the changes in a transaction using MAAPI and be able to process these according to your logic.

Could you explain a bit more the need for processing certain leafs before others?

I guess you are using an external running datastore right?

---

<div class="post-metadata">

**Author:** ![evyatar](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@evyatar](https://dmap-community.ductus.global/u/evyatar)\
**Post date:** [October 19, 2017, 8:47am UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/3 "2017-10-19T08:47:39Z")

</div>

Hi,

Yes, I am using external DB.  
Can I use MAAPI in a middle of commit transaction to get any information I need from the current transaction?

Thanks,

Evyatar

---

<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:** [November 28, 2017, 1:16pm UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/4 "2017-11-28T13:16:39Z")

</div>

Hi,

I would like to clear the question.  
We are working with external running DB. It is existing DB with other user interfaces (e.g. SNMP, cli) that already implemented.  
For each set/create/delete operation we reply with “CONFD\_ACCUMULATE”.  
when the transaction is committed, we go over the accumulated list and conficure it in the DB.  
since the DB exist before implementing the NetConf and yang, sometimes we dont have all the needed DB data (keys) from the yang.  
Is there a way to get a leaf’s value from the candidate DB which is in confd?  
how can we use the MAAPI in the case I described?

thanks  
Inbal

---

<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 28, 2017, 5:13pm UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/5 "2017-11-28T17:13:13Z")

</div>

You can attach to the current transaction using maapi\_attach(). See confd\_lib\_maapi(3) man page.

---

<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:** [December 3, 2017, 11:23am UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/6 "2017-12-03T11:23:44Z")

</div>

Hi,

thank you for your answer.  
I see in the user guide that in order to read value we should:

1. maapi\_attach
2. get the parameter value (e.g. maapi\_get\_int64\_elem(maapi\_socket, tctx-\>thandle, &b\_val, “/mtest/b\_number”)
3. maapi\_detach  
Since we use CONFD\_DAEMON\_FLAG\_STRINGSONLY flag, I wonder how we should read value of a leaf which was defined as integer for example.  
should we do maapi\_get\_int64\_elem or other API as maapi\_get\_str\_elem or maapi\_get\_buf\_elem.

Regards  
Inbal

---

<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:** [December 3, 2017, 12:13pm UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/7 "2017-12-03T12:13:01Z")

</div>

Hi,

As the UG says regarding CONFD\_DAEMON\_FLAG\_STRINGSONLY, the type you will receive will always be a C\_BUF. Choose our MAAPI get call based on that.

---

<div class="post-metadata">

**Author:** ![per](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@per](https://dmap-community.ductus.global/u/per)\
**Post date:** [December 3, 2017, 2:25pm UTC](https://dmap-community.ductus.global/t/set-priority-to-field/1597/8 "2017-12-03T14:25:32Z")

</div>

CONFD\_DAEMON\_FLAG\_STRINGSONLY applies only to the callbacks for a data provider daemon, i.e. set\_elem() etc - there is no corresponding MAAPI function that returns values as strings regardless of the actual type. But if you have loaded schema information, you can use confd\_val2str() to produce a string for a confd\_value\_t that you have read via MAAPI.
