Why do I have to click this action button twice for it to work?

I have an action button in a view that does the following:

lookup1:=@DbLookup(“”:“NoCache”;“”;“Management Template”;name;4);

sum1:=@Sum(lookup1);

lookup2:=@DbLookup(“”:“NoCache”;“”;“Management Template”;name;5);

sum2:=@Sum(lookup2);

diff1:=svb-ub;

diff2:=ssb-ub_1;

@SetField(“ub”;sum1);@SetField(“ub_1”;sum2);

@SetField(“rb”;diff1);@SetField(“rb_1”;diff2)

I have to click it twice for it to work. Why? It works fine after the second click.

Thanks!

Subject: Why do I have to click this action button twice for it to work?

Maybe try using FIELD instead of @SetField. @SetField was really designed to be used where a developer couldn’t use a FIELD statement, such as in an @If or @Do construct.

Looks like, from the code you posted, FIELD statements can be used instead of @SetField. Might be a long shot but can’t hurt to try it and see if it helps.