Replace viewable property with database query

So that sorting doesnt break

Change-Id: I863a02f9b72bdc4507a7c2ba3d06f6335eb483b9