# Get\_next getting called twicw with -1

**URL:** <https://dmap-community.ductus.global/t/get-next-getting-called-twicw-with-1/1225>\
**Category:** General\
**Created:** [May 17, 2017, 8:44am UTC](https://dmap-community.ductus.global/t/get-next-getting-called-twicw-with-1/1225 "2017-05-17T08:44:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vipbansa](https://avatars.discourse-cdn.com/v4/letter/v/a88e4f/32.png) [@vipbansa](https://dmap-community.ductus.global/u/vipbansa)\
**Post date:** [May 17, 2017, 8:44am UTC](https://dmap-community.ductus.global/t/get-next-getting-called-twicw-with-1/1225/1 "2017-05-17T08:44:30Z")

</div>

Hi,

ISSUE 1 :-

I am facing an issues where i have a “list” in my yang for operational data.  
I have implemented a get\_next API for the same.

But the issue is, get\_next is being called twice with next as -1. This is causing delays in scale setup.

In my get\_next api implementation, if next is -1, I allocate some memory and initiate some data structures. But as this is getting called twice, it is causing issues.

Is there a way I can ignore the first call of get\_next with -1 and process the second call of get\_next?

ISSUE2:-

As per my understanding, for operational commands transaction init and finish are two hooks which should be called whenever someone executes the show command.  
But in my case, transaction init is getting only once and for subsequent execution of show commands this is not getting called.

And transaction finish is never being called.

Can you please explain what could be wrong here?

---

<div class="post-metadata">

**Author:** ![josephm](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@josephm](https://dmap-community.ductus.global/u/josephm)\
**Post date:** [May 17, 2017, 9:14am UTC](https://dmap-community.ductus.global/t/get-next-getting-called-twicw-with-1/1225/2 "2017-05-17T09:14:53Z")

</div>

Hello,

1. this is regular behavior, for explanation/details, see related topic [here](https://discuss.tail-f.com/t/facing-issues-in-implementing-get-next-call/866).

2. 

Not exactly - these are the procedures that are called whenever new “transaction” is processed.  
This is not per each show command, but e.g. per user session logging into CLI (`init()`) and leaving CLI (`finish()`).

If you want to have separate transaction for each show command, check the option `"/confdConfig/cli/reallocateOperTrans"` in ConfD user guide - this will enforce init/finish for a separate show command requests of CLI user.
