Forum Discussion
Hello there,
This is a great question! I do need a little more context to properly test this on our end.
Can we see more of the code? For example, how are you making the query within FreeMarker? Are you using the rest context object, liql context object, etc.?
More information:
Once I have this information, I can test the method of retrieving data from the rest API against the data being retrieved. That will help us determine where the issue is.
Here is some more information that might be helpful:
Thanks so much for your help and patience,
Ryan
- Natkinson4 years agoGenius
Excuse my code if it's messy, I'm still learning all the Khoros stuff! 😅
Here's the basic query I'm using, I've stripped out a few things that didn't really pertain to my issue. The real issue is that the query isn't returning the status object, whether I run it here in my code or if I run it in the API browser in Studio
<#assign currentDate=.now?iso_local> <#assign occasionQry="SELECT subject, view_href, occasion_data, images FROM messages WHERE board.id='instructurelive' AND occasion_data.status IN ('upcoming','ongoing') ORDER BY occasion_data.start_time asc LIMIT 1" /> <#assign getOccasionData=commonUtils.executeLiQLQuery(occasionQry) /> <#list getOccasionData as occasionData> //Assign some variables from my query here </#list>
All the docs I'm seeing say that if I grab "occasion_data" I should be able to use the status object (but I'm still learning so I could be interpreting that totally wrong).
What I was trying to do later on with the occasion_data.status object was something like:
<#if occasionData.status == 'upcoming'> //do some stuff for upcoming events here <#else> //do stuff for ongoing events here </#if>
But that's where I got the null value error as if my query wasn't pulling in the status object. Can we not use status in this way? It clearly is tied to the event since I can pull it in for my WHERE filter but it doesn't come in as an object that I can use elsewhere in FreeMarker
Related Content
- 11 years ago