I have a dialog box with 2 fields, one for input and one for input history. I try to copy the data in the inputfield and append it to the existing data in the history field.
For each new input I also want to create a date for the new input. My code fails, and I don’t understand why. What’s wrong?
Code:
TempVar1:=“”;
TempVar2:=@Now;
@Set(“TempVar1”;HistOutput);
@SetField (“HistOutput”; TempVar1+@NewLine+TempVar2);
@Set(“TempVar1”;HistOutput);
@SetField (“HistOutput”; TempVar1+@NewLine+HistInput);
@Command([RefreshParentNote]);
@Command([RefreshWindow]);
@Command([RefreshHideFormulas])
Subject: Dialog box and @SetField
You’ll need to convert @Now to a textual value to combine with other text - ie TempVar2 := @Text(@Now));
hth
Tony
Subject: RE: Dialog box and @SetField
Thanks Tony this fixed that part, but the part to append new information to the existing still don’t work.
Subject: Dialog box and @SetField
Do not store dates in text form; different users may have different settings for date/time formatting, resulting in a mix of different formats as different people edit the document. You should use two different multivalue fields – one for the list of dates, and one for the list of comments. I’ve posted links elsewhere in this forum to a design library that contains a subform showing exactly how to manage such lists.
Subject: Dialog box and @SetField
Here is another variation which will number the text input, add the user name and the date:
Editable field…Input
@If(@IsDocBeingSaved; “”; Input)
Computed field…InputHistory
DEFAULT InputHistory := “”;
DEFAULT EditCounter := 0;
FIELD EditCounter := @If(@IsDocBeingSaved & Input != “”; EditCounter + 1; EditCounter);
@If(@IsDocBeingSaved & Input != “”; @NewLine + @Text(EditCounter) + " : " + @Text(@Today) + " " + @Name([CN]; @UserName) + " : " + @NewLine + Input + @NewLine + “___________________________” + @NewLine + InputHistory; InputHistory)