Lava Example - 76
Prompt
Let's say we need to use SQL to get information about the item identified in our URL.
For example, on this page, the Exercise's Id Key is {{ 'Global' | PageParameter:'ConfigurationItemKey' }}.
We can get the item's Id using {{ 'Global' | PageParameter:'ConfigurationItemKey' | FromIdHash }}
Use that to safely look up the title of this Content Channel Item!
Initial Code
{% sql %}
SELECT
[Title]
FROM
[ContentChannelItem]
WHERE
[Id] = ''
{% endsql %}
{{ results | First | Property:'Title' }}
Solution Lava
{% assign itemId = 'Global' | PageParameter:'ConfigurationItemKey' | FromIdHash %}
{% sql idNumber:'{{ itemId }}' %}
SELECT
[Title]
FROM
[ContentChannelItem]
WHERE
[Id] = @idNumber
{% endsql %}
{{ results | First | Property:'Title' }}