Forum Discussion

ryancjmp's avatar
2 years ago

liql query for message replies

I'm trying to get the replies from an event via liql.  My query looks like 

<#assign comments = liqladmin("SELECT * FROM messagess WHERE parent.id = '25324') />

This query is returning an empty array.  But I know for a fact that there are comments under the message with id = 25324.  For example, if I query one of the replies by it's id directly, I see that the message has a parent.id of 25324.

Are there some special permissions that are needed in order to query for replies?  Or am I missing something?

  • Ok I think I've solved this.  I had to include a board id in order for it to work.

    SELECT * FROM messages WHERE parent.id = '25324' AND board.id = 'the-board-where-the-parent-lives'

    This query is now returning what I expected.

    I didn't see this requirement in the documentation anywhere.  Did I just miss it?

  • Ok I think I've solved this.  I had to include a board id in order for it to work.

    SELECT * FROM messages WHERE parent.id = '25324' AND board.id = 'the-board-where-the-parent-lives'

    This query is now returning what I expected.

    I didn't see this requirement in the documentation anywhere.  Did I just miss it?

    • luk's avatar
      luk
      Boss

      Are you saying this is specific to the events module of Khoros? Usually the parent.id constraint does work for me, but I also often use something like this:

       

      SELECT id, subject FROM messages WHERE topic.id = '547' AND depth > 0

       

       

      which basically does the same, wonder if that works for your scenario as well?

      Just tried it out, created an event board, then an event (message/topic), commented on it and the query with parent.id works as intended. So the only thing I could think of why it wouldn't for you is that maybe you have message threading activated? And the comments are not direct replies to the original topic post? Because as far as I'm concerned, parent.id is mostly useful to create threaded discussions, if that's not the goal I tend to use topic.id (as above) because it allows me to also fetch the initial post (if you don't specify depth > 0)...

      • This did not work for me.  It still returned an empty array.  I tried using topic.id and parent.id.