# Convert url parameter string to integer

**URL:** <https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358>\
**Category:** CMS Development\
**Created:** [June 3, 2021, 2:35pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358 "2021-06-03T14:35:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [June 3, 2021, 2:35pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358/1 "2021-06-03T14:35:07Z")

</div>

I am trying to convert a url parameter to an integer and not having any luck with the correct syntax. The code below shows as an error.

```lia-code-sample
 {% set dealer = '{{ request.query|split("=")|last }}' %}
 {% set filterquery = dealer|int %}
 {% set row = hubdb_table_row(5241455, filterquery) %}

```

The first line works correctly. I believe the issue is with the second line when I set the filterquery.

Scenario-

I am passing a HubDB row id from another page as a url parameter.

Example - /dealer?id=47948622379

The dealer line above extracts the row id correctly but is a string at this point. Since the row id is an integer in the HubDB table, I am trying to convert it so that my hubdb\_table\_row line reads it correctly and renders the info from the table that I need.

If I render {{ dealer|int }} on my page, I know it’s not converting because it returns a 0.

Any assistance would be greatly appreciated.

Thanks,

Terry McMillan

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 3, 2021, 6:01pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358/2 "2021-06-03T18:01:51Z")

</div>

@Anton , any advice you can add here?

---

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [June 4, 2021, 9:25pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358/3 "2021-06-04T21:25:07Z")

</div>

Does anyone have any ideas? I was thinking this was probably a syntax issue and wouldn’t be too difficult to resolve.

Option B

Pass the customerid field in the url parameter since it’s a text field.

How do I tell it to use the “dealer” variable as the value for the customerid column when setting the row?

Something like this code (that doesn’t work)-

```lia-code-sample
 {% set dealer = '{{ request.query|split("=")|last }}' %}
 {% set row = hubdb_table_rows(5241455, 'customerid=dealer') %}

```

Thanks,

Terry

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 7, 2021, 2:50pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358/4 "2021-06-07T14:50:46Z")

</div>

Maybe @alyssamwilie can help out 🙏

---

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [June 7, 2021, 7:32pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358/5 "2021-06-07T19:32:02Z")

</div>

@dennisedson

Getting closer on a solution but still need help on syntax.

The following code does not work:

```lia-code-sample
 {% set dealer = '{{ request.query|split("=")|last|trim }}' %}
 {% set filterquery = "'"~'customerid='~dealer~"'" %}
 {% for row in hubdb_table_rows(5241455, filterquery) %}

```

The “set filterquery” line produces the following value - ‘customerid=01002827-al’

If I copy/paste that value in the hubdb\_table\_rows line as such:

`{% for row in hubdb_table_rows(5241455, 'customerid=01002827-al') %}`

**It works.**

What am I missing in the top code that is causing it not to recognize the filterquery value the same as the actual value?

I have wasted a ton of time on this and really need to get it resolved. Again, I feel like this should be pretty straight forward and I just can’t find the correct syntax.

Thanks,

Terry

---

<div class="post-metadata">

**Author:** ![tmcmillan99](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmcmillan99/32/93181_2.png) [@tmcmillan99](https://community.hubspot.com/u/tmcmillan99)\
**Post date:** [June 7, 2021, 9:45pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358/6 "2021-06-07T21:45:31Z")

</div>

I figured out. In case anyone is interested, here is the code that works-

```lia-code-sample
 {% set dealer = '{{ request.query|split("=")|last|trim }}' %}
 {% set dealerval = dealer|render %}
 {% for row in hubdb_table_rows(5241455, 'customerid='~dealerval) %}

```

Terry

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 8, 2021, 4:51pm UTC](https://community.hubspot.com/t/convert-url-parameter-string-to-integer/38358/7 "2021-06-08T16:51:29Z")

</div>

Love the persistence!
