Here is some Pseudo code for you
If not is list empty of the list you get back from CloudDB Then select the first item
You can learn how to work with lists here
Taifun