display Method problem

I am trying to link through several tables and them several records to find a field that matches the criteria.

I am getting a syntax error and cannot figure out why. Can anyone help me please ?

display smmEmplId fgt_psm_emplId()
{

EmplId emplId;
smmResponsibilitiesEmplTable smmResponsibilitiesEmplTable;

WHILE SELECT smmResponsibilitiesEmplTable where smmResponsibilitiesEmplTable.ResponsibilityId == “Development Officer” &&
smmResponsibilitiesEmplTable.RefRecId == smmOpportunityTable.RecId &&
smmOpportunityTable.OpportunityId == SalesQuotationTable.OpportunityId

EmplId = emplId

Return smmResponsibilitiesEmplTable.EmplId
{

Hi,

First have you checked ‘find’ method in this table? Doesn’t this serve your purpose?

And secondly, it appears this method is returning employee Id matching this condition. Instead of while loop, try using ‘select firstonly’ statement.