How to check condition in grid at outer page & again check condition in inner page if outer condition matches?

In main screen,will check condition with keyword in grid .if that matches then navigate to inner page and check other condition with keyword in grid.I f that matches should screen scrape information and should continue process.
If condition not matched in inner page,then it should navigate to outer page & check other rows.
how to handle this?