# HLA bubble text doesn't display zero (0) value?

**URL:** <https://discuss.saleae.com/t/hla-bubble-text-doesnt-display-zero-0-value/2587>\
**Category:** Support\
**Created:** [December 8, 2023, 3:12pm UTC](https://discuss.saleae.com/t/hla-bubble-text-doesnt-display-zero-0-value/2587 "2023-12-08T15:12:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![BitBob](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/bitbob/32/2292_2.png) [@BitBob](https://discuss.saleae.com/u/BitBob)\
**Post date:** [December 8, 2023, 7:14pm UTC](https://discuss.saleae.com/t/hla-bubble-text-doesnt-display-zero-0-value/2587/2 "2023-12-08T19:14:51Z")

</div>

Okay, I think I may have found a workaround:

```auto
        # Workaround to display zero value
        if self.scaled_position == 0:
            self.scaled_position = '0'

```

… based on a [StackOverflow article about rendering zero using a mustache template](https://stackoverflow.com/questions/13402972/render-0-value-using-a-mustache-template).

The only side-effect for my extension that I noticed, is that the CSV export added quotes around the zero. However, I’m not familiar with internal python type/conversion behavior, and if this workaround might have undesired consequences for other extensions that actually want to keep/use the integer value internally vs. just convert it to a string to output it to an **AnalyzerFrame** and display it within the bubble text.

Here is an example of the side-effect to the CSV exported text, was (output is 0 as though zero is an **integer value** ):

```auto
name,type,start_time,duration,"position","rate","scaled_position","scaled_rate"
  :
"Quadrature Encoder","QuadEncoder",0.2482546,7.6912e-05,0,12553.35174491749,0,25106.70348983498
  :
"Quadrature Encoder","QuadEncoder",0.40034152,0.000109412,0,8738.50886084273,0,17477.01772168546
  :

```

Now (output is “0” as though zero is a **text/string value** ):

```auto
name,type,start_time,duration,"position","rate","scaled_position","scaled_rate"
  :
"Quadrature Encoder","QuadEncoder",0.2482546,7.6912e-05,0,12553.35174491749,"0",25106.70348983498
  :
"Quadrature Encoder","QuadEncoder",0.40034152,0.000109412,0,8738.50886084273,"0",17477.01772168546
  :

```

So, is the ‘Template Engine’ being used to format & render the bubble text based on [Handlebars JS](https://handlebarsjs.com/) derived from [Mustache](https://mustache.github.io/), or is it something else?

Trying to answer that question, I did a different workaround that might be preferred (and seems to indicate that the ‘Template Engine’ is **Handlebars JS** or some other derivative):

```auto
    result_types = {
        'QuadEncoder': {
            # Workaround to output '0' rather than empty string ('') for zero (a 'falsy' value in python)
            'format': '{{#if data.scaled_position}}{{data.scaled_position}}{{else}}0{{/if}}'
        }

```

The pattern is a bit ugly, but at least you don’t need to modify the source object, just handle the special case of a falsy value in python (see [StackOverflow article on truthy and falsy](https://stackoverflow.com/questions/39983695/what-is-truthy-and-falsy-how-is-it-different-from-true-and-false) for good list of other python values that may need this trick to get an integer zero output in bubble text vs. an empty string).

---

_[View the full topic](https://discuss.saleae.com/t/hla-bubble-text-doesnt-display-zero-0-value/2587)._
