This is what I ended up doing.
I created a BLOB field in the database called “Job Description Blob”
field(40001; "Job Description Blob"; Blob) { }
In the page Extension, I created a field that is tied to a variable called “Job Description”
Within the field, I created a OnValidate trigger that calls a procedure called SetJobDescriptionBlobAsText
This takes what you have entered in the textbox field and updates the database.
field("Job Description"; "Job Description")
{
MultiLine = true;
Width = 200;
trigger OnValidate()
begin
SetJobDescriptionBlobAsText("Job Description");
end;
}
The variable called “Job Description” gets created as Text type.
“Job Description”: Text ;
The definition for the SetJobDescriptionBlobAsText looks like this
PROCEDURE SetJobDescriptionBlobAsText("Job Description": Text);
VAR
TempBlob: Record 99008535 TEMPORARY;
BEGIN
CLEAR("Job Description Blob");
IF "Job Description" = '' THEN
EXIT;
TempBlob.Blob := "Job Description Blob";
TempBlob.WriteAsText("Job Description", TEXTENCODING::Windows);
"Job Description Blob" := TempBlob.Blob;
MODIFY;
END;
I have created also another Procedure called GetJobDescriptionBlobAsText that reads the database blob and converts it into text.
This fills the text field via the page Trigger called OnAfterGetRecord
procedure GetJobDescriptionBlobAsText(): Text;
VAR
TempBlob: Record 99008535 TEMPORARY;
CR: Text[1];
BEGIN
CALCFIELDS("Job Description Blob");
IF NOT "Job Description Blob".HASVALUE THEN
EXIT('');
CR[1] := 10;
TempBlob.Blob := "Job Description Blob";
EXIT(TempBlob.ReadAsText(CR, TEXTENCODING::Windows));
end;
OnAfterGetRecord trigger
trigger OnAfterGetRecord()
begin
"Job Description" := GetJobDescriptionBlobAsText();
end;
And that’s it. I hope this helps anyone trying to do something similar.
I had to do a fair bit of research as I am pretty new to AL.
My next step would be to incorporate a Javascript Addin so that I can control the size of the text box as currently, on the modern client, even though I can type a novel in the textbox, i only ever shows 3 rows at a time.
Thanks again Alexander for the quick reply. Always appreciated.
Yann