Assuming self.ACCOUNT_CODE
is your observable, you would update it like so:
self.ACCOUNT_CODE(GenrateAccountCode(self.SUBACCOUNTS(), likeCode, accType));
Question
I have a subscribe function which fires when the dropdown value changes. I want to update another observable value inside this subscribe function. The probelm is when the control leaves this subscribe function the observable value got null or empty.
self.selectedSubAccount.subscribe(function (newValue) {
//alert("The Selected Account Code:" + newValue);
var likeCode = newValue.substring(0, 2);
var accType = "Control";
self.ACCOUNT_CODE = GenrateAccountCode(self.SUBACCOUNTS(), likeCode, accType);
});
Solution
Assuming self.ACCOUNT_CODE
is your observable, you would update it like so:
self.ACCOUNT_CODE(GenrateAccountCode(self.SUBACCOUNTS(), likeCode, accType));