Hi - this is a newbie question - please forgive if it is very basic or stupid.
There is a variable called NBP which gets computed when a condition is satisfied. Subsequently, if the condition fails, I want the originally computed value to be retained till the condition gets satisfied again - in which case the value will get recomputed and updated.
How do i do this?
The code extract is as follows:
var NBP;
if ((objob.NQ + objstock.CFQ) == 0) {
NBP = round(((objob.SQ * objob.SP) - (objob.BQ * objob.BP) - objstock.CFV),4);
}
objstock.NBP = NBP;
assuming the condition NQ + CFQ == 0 is satisfied, the value gets worked out to say β100β.
subsequently, when NQ + CFQ != 0, i want NBP to remain as '100β
later if NQ + CFQ == 0, the formula will be used and say the value is arrived as β150β, then NBP should get updated as β150β.
the values of NQ, CFQ, SQ, SP, BQ, BP, CFV, etc keeps changing frequently β currently when condition is satisfied, NBP is getting computed and displayed correctly - but when the condition fails the value of NBP becomes β0β.
Any help will be highly appreciated.
If you want me to post the whole code, please do let me know.