Simplicty and flexibility!

Nifty little ExecDQL sample (A lot of you ask what is the point....see for yourself!)

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

Nifty little ExecDQL sample (A lot of you ask what is the point....see for yourself!)

Download Sample!

One thing we will try to do more and more is to showcase the functionality in our products. It is not much point in us making it if nobody use it.

It is a little hard to get you guys to change "tack". I don't blame you as it has been "business as usual" for more than 20 years with very little change or new functionality.

DE8 is just an early warning system for what is to come so get on board now ;-)

One problem with traditional DFW is to get the functionality to behave exactly like YOU want it, and even if you managed around problem it blinked/flashed and was very wobbly at the best of time.

DQL is one of the corner stones of DataEase and with ExecDQL we have taken it to a new level in DE8, but we need to show you why this is and this is one small attempt.

We made this code bit because of sharing of applications with DG3 and the web, and then you need to move the images relative to the web server. It is not simply good enough to get a path to the image and save it in the Application, but then that was maybe never good enough? What happens when you move the application?

This sample use the GetFileName() function to open a Browser dialogue to browse for the image. One of the parameters for GetFileName() is GetCurrent("MyDocuments") which is new function to find file paths for your user on this workstation. GetCurrent("MyDocuments") simply give you the path to MyDocuments for active user.

When we have picked the image we use the function CopyAFile() with a from path directly from GetFileName() but with a ToPath built up (concatenated) by GetCurrent("AppPath") - this give the path to the active app, the subdirectory \images\ and then we strip of the path from the filename we got from GetFileName() with StringFrom() so we are left with just the file name of the image (very nifty new function in DE8).

Now we have copied the file to the wanted location so the only part that is left is to push the image file name into the form/field Image.

We do that with SetValue("Image",StringFrom("Retval2","\") -- this is simply the same function we used above to get the filename again.

One of the nifty bits with ExecDQL is that it has two contexts. 1. is the data cursor for the DQL and 2. Is the Object context of the form. i.e. you can push and manipulate objects in the active form.

We did that very little here, but then again this is a practical example.

When we have pushed the Value into the Image field, the rest happens normal DE style. A derrived Imagefield called ImageVirt is triggerd by new value in Image (derrived) the formula is calculated and the image is displayed.


if you look in the the PickAnImage form in DT you see there is a lot of support fields that is hidden in RT. This is because the best way of using ExecDQL is to use MemoExecDQL. But due to limitations in the DFW format, you need to lookup the value from a place to be able to execute it directly and that is what we do here.

We simply hardcode DQLNR 1 in field DQLNrVirt and the lookup the DQL in DQLVIrt. This code is then executed on the button.

This might look a little "unelegant" but the benefit far outweighs the problems as it means you can store and execute code in Runtime anywhere at any time....

Written by DataEase 19/11/13 at 18:23:25 Dataease [{8}]FIVE