@SetField problem

I read through several posts on this topic but none could help me.I have a button on a document, executing below code:

FIELD AuditText := AuditText;

FIELD Audittrail := Audittrail;

Emailbody:=“blablabla”;

TodayStr :=@Text(@Day(@Today)) + “-” + @Text(@Month(@Today)) + “-” + @Text(@Year(@Today));

AuditText := Audittrail + @NewLine + "Indirect Material Order sent to Storeroom Services on " + TodayStr + “.”;

@If(showinst=“1”;

@Do(

@Command( [EditDocument] );

@SetField(“showinst”;“0”);

@SetField(“Audittrail”;AuditText);

@Command([ViewRefreshFields]);

@MailSend(supv;“”;“”;“Indirect Material Order - Sequence nbr: " + SeqNbr;Emailbody;”";[IncludeDoclink]);

@Command([FileSave]);

@Command([FileCloseWindow])

);“”)

The problem is with the instruction @SetField(“Audittrail”;AuditText);

The field Audittrail is a computed text field with the value

@If(@IsNewDoc;"Composed by "+@Name([CN];@UserName)+ " on " + @Text(@Now);Audittrail)

I don’t succeed in adding the second line to the field Audittrail.

Is there something wrong with the @SetField instruction?

The instruction @SetField(“showinst”;“0”); however, is working fine.

Any clue?

Subject: @SetField problem

Do you have an actual field AuditText on the form?

If you do, I would not name a temporary variable the same (to be on the safe side). If you don’t, the first line makes no sense.

You can use @StatusBar or @Prompt to verify what’s in AuditText the moment before you assign it to the field Audittrail.

Also, there shouldn’t be a reason to have Audittrail as a computed field, if it is just meant to compute once. Set it to computed when composed instead.

Subject: RE: @SetField problem

I set field Audittrail to “computed when composed” and it works!Thanks a lot!