How can I query whether a long text variable is empty?

You can use

  if text[xxx]

     ...

  endif

If you want to compare two long text variables use the statement "CompareText".