?Images
?Images
Hi there,
a simple question: is there a way to save images (gif) into a dataease form?
Regards.
Re:?Images
Nobody?
Re:?Images
You can't save an image as part of the form itself. The image will be saved as a separate file in the application catalogue if you paste it into the design.
Whatever format the image was before you pasted it, it will be saved as a BMP with a generic name like CLPXXX.BMP.
You can inset images, but make sure they are placed in one of the catalogues listed in the image path. The safest is to simply put them in the application catalogue.
If you want to save images in a separate catalogue relative to the app catalogue simply insert them as an ImageField instead (virtual) and insert the image file name and path as the derivation.
EX.
".\images\MyImage.gif"
This will browse relative to the app catalogue and load the image from the subdirectory images.
You can in theory save images as BAS64 data in a Memo field and display it in a WebField as we have done in our OrderHeadSample but it in most cases that would be to shoot a sparrow with a cannon....
This is the Base64 representation (a part of it only) of the image below.
Base64 is a very "ineffective" format so it text file gets very big but it is handy when you want small images that should "travel".
Re:Re:?Images
Hi there,
thank you for your reply. I need to export to pdf some data and I already have images saved in the form in Base64 format. There is a routine that export those data and takes care to create a proper pdf file and it works. The problem is that user does not know exactly what image he is exporting (he can rely on a description field, but sometime the description is not enough), so I was looking for a way to show user the image. Your trick to use a webfield it looks fine to me. I am trying to set it up in my application:
-I created a memo field (called B64) with an EditBox visual control;
-The user put in the B64 field the image encoded in B64, with <p>.header</p><p><img alt="" src="data:image/jpeg;base64, ahead and "</img> behind
-There is a virtual memo field (called IMG) with a WebField visual control that has as derivation the content of B64 field, so it contains same data as in B64 field
As far as I understood the IMG field should shows the image, but it is actually empty; any suggestions or ideas?
Re:Re:Re:?Images
Well, I got myself an answer. Using the field as an AdvancedWebField did the trick. Now I have another problem: I need to concat some text and a memo field, so the user has not to put <img src="data:image/jpeg;base64, before the encoded image and "</img> after. What derivation should I use?
Re:Re:Re:Re:?Images
Memos can't be concatenated as the result of the concat will only be 255 characters long. This is why the Memo class of functions is a Manipulation class of functions.
The "old" de8 way of doing it would simply be
1. to have a virtual AdvancedWebField with no derivation.
2. Have a Memo Field that contain the Base64 info.
3. Have a virtual field or a Button with the derivation to append them to the Advanced WebField.
MemoCopy(MyAdvancedField,"<img src="data:image/jpeg;base64",1)+MemoMemoCopy(MyAdvancedMemo,MyBASE64,0)+MemoCopy(MyAdvancedMemo,"</img>",0)+RefreshForm().
This is written from the top of my head, buy you will get the gist/direction.
But in 8.5.Latest you could simply use a MemoExecDQL to accomplish the same.
DQL
For MyDataStore with data-entry field1.
List Records
MyBase64Data.
Body.
.items
<img src="data:image/jpeg;base64[{MyBase64Data}]</img>
.end
MemoExecDQL(MyDQLMemo,"Filter I want to employ","","","","memo:myadvancedwebfield","MyBODYMemo")
Re:Re:Re:Re:Re:?Images
Hi there,
thank you for the suggestion. I tried the derivation/button solution and it almost works. The problem here is " (the quotation mark): I cannot put it in the MemoCopy instruction, because dataease thinks is the end of the string so it generates an error. I tried tthe escape sequence \", but it did not work. Then I tried to use " but it did not work too. Oh, just for the records (and for sake of future readers of this thread) last instruction is RefreshForm and not FormRefresh. Anyway, the question now is: how can I put a " quotation mark in a memo field?
Regards.
Escape in DataEase 8 NEW FUNCTIONALITY! Chr() and StringEscape()
Dear Gorge.
Your contributions to the "enlightenment" of the DataEase user base in invaluable. We need these pointers to get the message out there about challenges and solutions.
First on a happy note...he,he.
Several of our developers including myself is "dyslectic" so the majority of "bugs" we have in our code is misspellings..he,he. The problem of course is that your brain read it as right when the compiler read it "correctly" as wrong...FRUSTRATING!
You are of course correct it is RefreshForm() and that is so it should fall in line with RefreshScreen() and come next to it in the list. However the correct name should be FormRefresh...he,he so that is why my brain revert to that name.
You have however give us credit for this being written "a cappella" he,he...Sorry! End of the joking!!
Back to your problem.
Pre 8.x there as a lot of problems with " and other characters like CR ESC TAB etc. Simpy there was no real way of introducing them in your code.
The first fix for this is CHR()
This simple function will return the corresponding ASCII character for any numerical value. It is to be used in combination with concat(), MemoCopy(), MemoMemoCopy(), MemoReplace(), MemoFind() etc.
It is a very useful function for building advanced strings or documents.
To find the value of any character use this website:http://asciivalue.com/index.php
This function in itself was a great help to be able to include any character in the code.
With the introduction of ExecDQL it became apparant that even if this was a great improvement it wasn't enough.
for instance the simple DQL:
define "retval" text .
retval := SetValue("MyField","Test") .
Would as a direct execdql be like this.
ExecDQL(concat("define ", chr(34),"Retval",chr(34)," . reval := SetValue(",chr(34),"MyField",chr(34),",",chr(34),"Test,",chr(34),") .") -- see how we skip the remainder of the arguments, you can do that on all ExecDQL functions now as they are variable argument functions
As you can tell this is a big job for a small DQL, and will quickly reach a lot of DE limitations like arguments on Concat (32) etc.
CHR() should have been a part of the DataEase Lexica forever, but arrived late in 8.0, but another thing that should have been there forever is a ESCAPE system for "illegal" characters.
This was introduced in 8.2
StringEscape
To allow users to include reference to certain "forbidden" characters in a DE string and return the parsed result.
Characters include is:
" = /'
CR = /CR (New line)
TAB=/TB (Tab)
Tags are case sensitive, so /cr would not be escaped
This function will escape any text inputed to it and return it with " CR and TAB etc.
However, but as so many other functions in DE8 it is a "fallback" function to cover "other" eventualities.
All String functions from 8.2 have this built in including Concat(), MemoCopy(), ExecDQL() etc.
So you simply need to write now:
ExecDQL("define /'retval/' text . retval := SetValue(/'MyField/',/'Test/') .")
Which is slightly more elegant we think.;-)
Re:Escape in DataEase 8 NEW FUNCTIONALITY! Chr() and StringEscape()
Oh, thanks, as a long time fora user (and formerly usenet user) I really think sharing information is the basis in the IT. I hope not bothering too much with my constant questions. Anyway, now everything works like a charm.
Re:Re:Escape in DataEase 8 NEW FUNCTIONALITY! Chr() and StringEscape()
No BOTHER at all! We can only reply if people as the question.
The more things get put out there the easier it if for everyone to pick it out and use it.
There is so much new stuff in DE8.x so we need to keep on "harping" to get it all out there.
All the best!