# \[BUG\]hubl sort filter bug on float number

**URL:** <https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683>\
**Category:** CMS Development\
**Tags:** local-development, enterprise\
**Created:** [July 22, 2025, 4:01pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683 "2025-07-22T16:01:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![iqoOopi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/iqooopi/32/52644_2.png) [@iqoOopi](https://community.hubspot.com/u/iqoOopi)\
**Post date:** [July 22, 2025, 4:01pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/1 "2025-07-22T16:01:36Z")

</div>

test1: {{property.suite\_types|map(‘baths\_low’)}}

test2: {{property.suite\_types|map(‘baths\_low’)|sort(false,false,‘’)}}

I have some code like above, suite\_types is an array of objects where each object has a property called “baths\_low”. “baths\_low” is some float number like 0.5, 1, 1.5 etc.  
When I test the code, as you can see below, the sort returns nothing if the value is in float and has different.  
sort works fine on whole number through…

 ![iqoOopi_0-1753199969176.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/2/7/2771a57f684ea61f27dc7d498918fb77461ca62c.png)

---

<div class="post-metadata">

**Author:** ![MichaelMa](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MichaelMa](https://community.hubspot.com/u/MichaelMa)\
**Post date:** [July 22, 2025, 4:59pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/2 "2025-07-22T16:59:44Z")

</div>

I believe the data in the array has to be the same type. You can try putting a |map(“float”) to convert all the numbers into a float before sorting.

`{{property.suite_types|map('baths_low')|map('float')|sort(false,false,'')}}`

---

<div class="post-metadata">

**Author:** ![FaramarKolivand](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/faramarkolivand/32/76210_2.png) [@FaramarKolivand](https://community.hubspot.com/u/FaramarKolivand)\
**Post date:** [July 22, 2025, 9:59pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/3 "2025-07-22T21:59:14Z")

</div>

map(‘float’) is invalid in Hubl.

---

<div class="post-metadata">

**Author:** ![MichaelMa](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MichaelMa](https://community.hubspot.com/u/MichaelMa)\
**Post date:** [July 22, 2025, 10:34pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/4 "2025-07-22T22:34:03Z")

</div>

Not sure why you think so.

Documentation for map states that you map a filter.

- Alternatively, you can let it invoke a filter by passing the name of the filter and the arguments afterwards.

> **[HubL filters - HubSpot docs](https://developers.hubspot.com/docs/cms/reference/hubl/filters)**
>
> HubL filter list and examples for HubSpot CMS developers.

And it clearly works although you have to be careful on the order of the filters.

 ![MichaelMa_1-1753223618414.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/5/5165b50bbdb01cd0766f5676b1f861b11a8e6394.jpeg)

 ![MichaelMa_0-1753223609574.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/4/e40b2a00afb424d02e7bee6afd0edcf63b7cd861.png)

---

<div class="post-metadata">

**Author:** ![iqoOopi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/iqooopi/32/52644_2.png) [@iqoOopi](https://community.hubspot.com/u/iqoOopi)\
**Post date:** [July 22, 2025, 10:14pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/5 "2025-07-22T22:14:19Z")

</div>

they are all type ‘number’ in my hubdb column, unless hubspot treat 1 as int, 0.5 as float internally.

even then the sort filter should handle number type automatically

---

<div class="post-metadata">

**Author:** ![MichaelMa](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MichaelMa](https://community.hubspot.com/u/MichaelMa)\
**Post date:** [July 22, 2025, 10:24pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/6 "2025-07-22T22:24:25Z")

</div>

Yes, hubspot treats the whole numbers and decimals numbers differently. If you build an object array in hubspot similar to your structure, you can see that apply a sort doesn’t work.

 ![MichaelMa_4-1753223032110.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/a/ba947997f1565126315cb6d66a4c04e51c634050.png)

If you apply a map|(‘float’), it should resolve it

Test 01 should match similarly to what you should in your original post and will fail to output sometihng.

Test 02 is appyling a map float.

 ![MichaelMa_5-1753223038706.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/0/f04cce0e2a07e9bc13b8ed1697cc3295f4f2d870.png)

---

<div class="post-metadata">

**Author:** ![FaramarKolivand](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/faramarkolivand/32/76210_2.png) [@FaramarKolivand](https://community.hubspot.com/u/FaramarKolivand)\
**Post date:** [July 22, 2025, 10:02pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/7 "2025-07-22T22:02:06Z")

</div>

Try sorting the original array directly before mapping

---

<div class="post-metadata">

**Author:** ![iqoOopi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/iqooopi/32/52644_2.png) [@iqoOopi](https://community.hubspot.com/u/iqoOopi)\
**Post date:** [July 22, 2025, 10:11pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/8 "2025-07-22T22:11:21Z")

</div>

same issue as it is the sort function error out when comparing 1 with 0.5

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [July 23, 2025, 12:16pm UTC](https://community.hubspot.com/t/bug-hubl-sort-filter-bug-on-float-number/136683/9 "2025-07-23T12:16:44Z")

</div>

Hi @iqoOopi

This happens when a list contains a mix of whole numbers and decimals. It can cause errors during sorting or calculations. That’s because HubSpot’s Java-based backend treats integers and decimals differently and won’t automatically convert between them.

**Easy fix:** Use the float filter to convert all values to decimals first.

```lia-code-sample
Easy fix: Use the float filter to convert all values to decimals first:

{% set suite_types = [
 { baths_low: 12 },
 { baths_low: 0.1 },
 { baths_low: 10 },
 { baths_low: 0.5 }
] %}

{{suite_types|map('baths_low')|map('float')|sort(false,false,'')}}

```

This will return sorted array [0.1, 0.5, 10.0, 12.0]

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.

Thanks!
