Today I was asked to make a field on a page that could hold a lot of data. Sort of like the notes.
This is off course not possible, but there are a few work arounds.
Create/use an add-in to stream a BigText/blob to a field.
But I do not wish to have to update all the users their installation with the DLL.
Use the existing options in NAV to get as far as possible.
We can use following properties/options to find some working way:
– Blob fields
– BigText fields
– MultiLine property
– Blob SubType property
Always fun, playing around with all kinds of options.
I created a field in a table of type blob and set subtype on Memo. Added this on a page and ran it.
This creates a textbox which is not editable, and pretty much fucks up your layout. Because of the length of the box, all first columns are very long. (see screenshot)
So this was not a good solution. Adding the property MultiLine, or setting subtype to memo did not have any effect.
Up to the next option. Field of type BigText, except, this does not exist in the field types. Alternative, using the blob in the table, and reading it into a BigText on the page. This makes the field indeed not as large on the page. But no automatic MultiLine. Setting the property MultiLine has a nice effect on a BigText variable…
It appears that the MultiLine property only works for a variable of type Text!
So I was off to my last and final option. A page variable of type Text with length 1024. Adding it to the page and setting the property MultiLine to true. And behold:
As a finishing touch, some code to stream my variable into/out of my blob. Here is the code:
IF NOT Remark.HASVALUE THEN
MemoText := ''
MemoText – OnValidate():
IF MemoText <> '' THEN BEGIN
And my variables:
MemoText - Text
MemoReader - InStream
MemoWriter - OutStream
Well, I agree, it is not a perfect solution, a blob directly on a page would be still better. But at least, now I have 1024 characters instead of 250. And all in 1 field.
Oh, and I also know, I could also split my text string into 5 NAV Text fields instead of 1 Blob.
Doing this would probably result in better usage of SQL Server variables.
But converting this, shouldn’t be a problem for anyone I think 🙂