How to assign filtered record field values to form Control.

satish_navsatish_nav Member Posts: 65
edited 2011-07-25 in Dynamics AX
I am new to Axapta\X++

When i select a EmpNo from lookup refers EMPTable, other details from the emp record(name. designation,etc..) have to fill in other controls in my from.

This have to happen in the EMPNo onvalidate().

for this i have filtered EMPtable as below, but iam struggling to assign the filed values from filtered record to form controls.

Error: I am gettign syntax error, where i underlined in the code.


public boolean validate()
{
boolean ret;
str TestName;
EmpTable ETable;
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
QueryRun queryRun;

;
queryBuildDataSource = query.addDataSource(tableNum(EmpTable));
queryBuildRange = queryBuildDataSource.addRange(fieldNum(EmpTable,EmpNo));
queryBuildRange.value(EmpNo.text());

queryRun = new QueryRun(query);


while(queryRun.prompt())
{

Queryrun.get(tableNum(EmpTable));
TestName = EmpTable.EmpName;

}

ret = super();
return ret;
}

Can any one help me..how to do this..
Thanks in advance..

Satish...

Comments

  • satish_navsatish_nav Member Posts: 65
    I got solution my self(with my frnd) for this issue.

    i used below peace of code:
    select EmpName from et where et.EmpNo == _EmpNo.text();
    Ename.text(et.EmpName);

    here _EmpNo.text() is the droupdown control in the my form
    Ename.text() is the text box name, where i print the selected empname in my form.

    we can write this code either droupdown textbox onvalidate() or put cmd button and write this on push();
    Thanks in advance..

    Satish...
Sign In or Register to comment.