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.
{% 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.
Getting closer on a solution but still need help on syntax.
The following code does not work:
{% 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.