Same expression working on one page but not on another

I have an array in a session variable

I am able to look up a value in it on one page using

 <button id="btn1" class="btn" 
dmx-text="session.data.stats.where('gid','A100','==')[0].FIB">Button</button>

but on another page this same expression is not working

<button id="btn2" class="btn bg-warning"
 dmx-text="session.data.stats.where('gid','A100','==')[0].FIB ">Button</button>

I have added session on both pages.
If i modify the expression to

 <button id="btn2" class="btn bg-warning" 
dmx-text="session.data.stats.[0].FIB">Button</button>

then i am able to make it work on the second page too. Why is the ‘where’ expression not working on the second page?

The following was missing on the page on which it did not work
now it is working

<script src="../dmxAppConnect/dmxFormatter/dmxFormatter.js" defer=""></script>