The conditions for investigating with Sonography
1. Before surgery to confirm the contents of the Hernial Sac.
2. To check on any infection or any ischemia
3. To check the motility of the contents in case of intestines.
It would be recommended to undergo Sonography in empty stomach.
Hope this answers your query.