# HLA result\_types format template string

**URL:** <https://discuss.saleae.com/t/hla-result-types-format-template-string/3725>\
**Category:** Uncategorized\
**Created:** [May 6, 2026, 8:05pm UTC](https://discuss.saleae.com/t/hla-result-types-format-template-string/3725 "2026-05-06T20:05:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maehw](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@maehw](https://discuss.saleae.com/u/maehw)\
**Post date:** [May 6, 2026, 8:05pm UTC](https://discuss.saleae.com/t/hla-result-types-format-template-string/3725/1 "2026-05-06T20:05:42Z")

</div>

Hi!

Is there public documentation about the template strings and how they work/ what they allow?

I’ve used

`'format': '0x{{data.mosi}} / 0x{{data.miso}}'`

for my HLA which takes in [SPI - Frame Format - Frame Type: “result”](https://www.saleae.com/support/extensions-api/hla-frame-format-reference/spi-analyzer).

The type of both properties `mosi` and `miso` is `bytes`. However, my bit width is the typical 8 bits. So there’s usually only a single byte to be displayed.

So for an input of 0xA0 and 0x00 I get “0x[A0] / 0x[00]”.

How can I access the first byte only? I tried by putting `{{data.miso[0]}}` there but that gives a template error.

Or simply put: how do I get rid of the square brackets?

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/2X/f/f356d88a4848eb5bdcb51c5ecf498edf74439db8.png)

---

<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:** [May 7, 2026, 3:30am UTC](https://discuss.saleae.com/t/hla-result-types-format-template-string/3725/2 "2026-05-07T03:30:22Z")

</div>

I still wonder this myself, having struggled with a different issue (since fixed) with HLA formatting:

> [@HLA bubble text doesn't display zero (0) value?](https://discuss.saleae.com/t/hla-bubble-text-doesnt-display-zero-0-value/2587):
>
> While experimenting with high-level analyzer (HLA) for quadrature decoder (see [other thread](https://discuss.saleae.com/t/analyser-for-quadrature-encoder/2556)), I noticed that a zero value didn’t display in the bubble text of my draft HLA: as the zero value (0) was in the scaled\_position data – see Data table view: (Note: original thread only had position column showing, while technically scaled\_position is output) Some snippets from the analyzer python script: The result\_types definition: result\_types = { 'QuadEncoder': { …

I’m still guessing that it’s [Handlebars JS](https://handlebarsjs.com/) template engine (or a compatible/similar syntax), which internally formats the HLA python data for GUI display. I understand the Logic 2 program itself is based on the [Electron framework](https://www.electronjs.org/) – which uses the chromium display engine for the GUI (typically implemented using Node.js and other JavaScript).

Meanwhile, if you want more control of the display text, you might try converting python type from `bytes` to a more compatible data type in the HLA python code before returning the value vs. directly returning a `bytes` typed object (which isn’t as cleanly passed between python and JavaScript)?

Finally, perhaps Saleae could confirm what specific syntax the HLA format string is using?

---

<div class="post-metadata">

**Author:** ![maehw](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@maehw](https://discuss.saleae.com/u/maehw)\
**Post date:** [May 7, 2026, 7:01am UTC](https://discuss.saleae.com/t/hla-result-types-format-template-string/3725/3 "2026-05-07T07:01:28Z")

</div>

Thank you for the background information and your presumptions on the internals.

As a temporary solution, I can shift the problem to the data generation side, i.e. where the `AnalyzerFrame`s are emitted:

```auto
                    return AnalyzerFrame('result', frame.start_time, frame.end_time, {
                        'mosi': frame.data['mosi'][0], 'miso': frame.data['miso'][0]
                    })

```

However, this will display single digit HEX numbers as such and not in `:02X` format. I can either deal with it or need to emit the formatted strings directly (for now), I guess.

And

```auto
                return AnalyzerFrame('result', frame.start_time, frame.end_time, {
                    'mosi': f"{frame.data['mosi'][0]:02X}", 'miso': f"{frame.data['miso'][0]:02X}"
                })

```

works for me.

Stacking HLAs is currently not supported, I guess. So it probably really does not matter for now. Just thinking about export and post-processing.. but there’s probably also everything just a text string.

Still interested in template details, though. 😉

---

<div class="post-metadata">

**Author:** ![huffman](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@huffman](https://discuss.saleae.com/u/huffman)\
**Post date:** [May 13, 2026, 9:50pm UTC](https://discuss.saleae.com/t/hla-result-types-format-template-string/3725/4 "2026-05-13T21:50:01Z")

</div>

Hey there!

@BitBob is correct, Handlebars is used for formatting.

The core issue is that byte arrays are converted to strings and then formatted with the template. At the moment, the best way to get around this is to format the value as a string like you are doing, but it has the downside that it might use more memory to store, and will display differently than the raw byte array value in the sidebar data table and when exporting.

I’ll add a ticket internally to see if we can implement a backwards compatible way to get more flexibility, as well as provide functionality to format an integer as hex (like in your last example).

Ryan
