Unable to update data from a lookup field

Unable to update data from a lookup field

HI all,

I have created a table with three fields X1, X2 & X3.
Then created a form with two fields - drop down list for X2 and a blank field for X3.

All I want to do is when the user changes the value of X2, it should automatically update the second field with the value of X3.

cartType = ItemCodeCarts [CartNo == input.CartNo];
input.Qty_Available = cartType.Qty_Available;

The first line fetches the records, but the second line does not display the fetched records.
Pls help !!