我在 BC 扩展中创建了一个表格和一个页面。表中的字段之一是类型:BLOB。它没有显示在页面上。我试图复制销售标题表/销售发票页面中的“工作描述”BLOB 字段发生的情况。我哪里错了?请参阅下面的代码。提前感谢您的帮助。
table 50050 LogSheets
{
fields
{
// Various fields...
field(9; DescriptionOfTasksPerformed; BLOB)
{
Caption = 'DescriptionOfTasksPerformed';
}
}
var
ReadingDataSkippedMsg: Label 'Loading field %1 will be skipped because there was an error when reading the data.\To fix the current data, contact your administrator.\Alternatively, you can overwrite the current data by entering data in the field.', Comment = '%1=field caption';
// Cribbed from Sales Header (table & page) - WorkDescription
procedure GetTasksDescription() TasksDescription: Text
var
TypeHelper: Codeunit "Type Helper";
InStream: InStream;
begin
CalcFields(DescriptionOfTasksPerformed);
DescriptionOfTasksPerformed.CreateInStream(InStream, TEXTENCODING::UTF8);
if not TypeHelper.TryReadAsTextWithSeparator(InStream, TypeHelper.LFSeparator(), TasksDescription) then
Message(ReadingDataSkippedMsg, FieldCaption(DescriptionOfTasksPerformed));
end;
procedure SetTasksDescription(NewTasksDescription: Text)
var
OutStream: OutStream;
begin
Clear(DescriptionOfTasksPerformed);
DescriptionOfTasksPerformed.CreateOutStream(OutStream, TEXTENCODING::UTF8);
OutStream.WriteText(NewTasksDescription);
Modify;
end;
}
page 50051 LogSheetCard
{
Caption = 'Log Sheet';
PageType = Document;
RefreshOnActivate = true;
SourceTable = LogSheets;
layout
{
area(Content)
{
group("LogSheetDetails")
{
// Various fields...
}
group("Tasks")
{
Caption = 'Description of tasks performed';
field("DescriptionOfTasksPerformed"; Rec.DescriptionOfTasksPerformed)
{
ApplicationArea = Basic, Suite;
Importance = Additional;
MultiLine = true;
ShowCaption = false;
ToolTip = 'Description of tasks performed';
Editable = true;
trigger OnValidate()
begin
Rec.SetTasksDescription(TasksDescription);
end;
}
}
}
}
var TasksDescription: Text;
trigger OnAfterGetRecord()
begin
TasksDescription := Rec.GetTasksDescription;
end;
}
在上面代码的底部,有一行:trigger OnAfterGetRecord。这又调用 GetTasksDescription,后者又调用 CalcFields(DescriptionOfTasksPerformed);我相信,这就是在“销售表”/“销售发票”页面中是如何完成的,但在“执行的任务描述”下的页面上仍然没有显示框(见下文)?我已经确认这些代码行是通过将消息行放入相关过程中来调用的。这是一个谜题。 截屏