Simplicty and flexibility!


DataEase 8 - Best Practice Dynamic Document Generation/Editing ExecDQL/Memo/SetVclass (Ver 8.0.0.1273)

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

DataEase 8 - Best Practice Dynamic Document Generation/Editing ExecDQL/Memo/SetVclass (Ver 8.0.0.1273)

I have been playing around a little with DataEase 8 and generated a simple sample on how to generate documents for further editing by combining the new function classes in DataEase 8. I hope and think that this will show that the time of generating Word documents and that stuff is over. You can get a better result directly in DataEase. You will need the latest 8 to insure that you are not outversioned...;-)

http://www.dataease.com/static/files/DataEaseFull-8.0.0.1273.exe

Download Sample App!

How to get it to work.

Download and install the latest DataEase 8. Open the Zip and copy the entire catalogue to My DataEase under My Documents. Open DataEase and Open Application MemoAndExecDQLSample

Usermode:
Username: User
Password: User

Developer Mode:
Username: High
Password: High

View an existing agreement or simply hit New Agreement. The Loan Agreement form opens. Here is some cool stuff too. All the fields have "Placeholders". That is not a standard feature in DataEase 8 yet, and the way we have done it is simply by using Virtual Editable fields that has the placeholder as derivation together with a read back from the real data fields if there is an existing value.

We will implement placeholders as part of the standard because it will remove the need for labels and make niftier designs. In this form that we use both to vie Agreement Details as well as Creating new ones, we need some neat logic to display the right button for either viewing or generating a new agreement. This is controlled via a form virtual field call Dummy1.

This virtual field simply check some logic and hide and view the correct buttons. You fill in the details etc, (this should be properly structured with an address book etc, but its just a demo so what the heck. Stupid does it! We use the new DatePicker() function to pick the date (you can type it in manully if you like) and push the value into place with the new SetValue() (how did we live without it....) SetValue("Date",datepicker())

It all looks like this when you do it in real life.

The trigger mechanism to activate the Generate Agreement button is when you select an agreement Template. When you do that, the DQL for that Template is loaded into the virtual field DQL and is ready to be executed... The Generate button is then activated.

The rest is then history...;-) This is just a small and stupid demo on what you can do with the new Memo class, GUI class and DQL class in symphony.... You can manipulate and build your own DQL in a memo or a file from a DQL if you like and then execute the new DQL from that same DQL and then do that again and again. You can push and pull the result, chew and swallow or spit it out. There is no limitations to the flow or the result, just your imagination!

The system explained.

1. Templates. We have templates that is designed in the HTMLEditor in any way you like. You then put in tags in the document that you will later replace. So far quite straight forward.... But the cool bit is that in templates next to the document there is a little DQL editor where you put in the DQL that will manipulate the document and do the further "actions" this script will be called from the Generate Agreement button in the LoanAgreementsView form. In practice this DQL can do whatever it want. define temp "retval" text.

define temp "retval" text.
for LoanAgreement with Agreement Number=data-entry field1 ;
modify records<br>dummy :=MemoMemoCopy(Agreement , any relTemplate Template ,1) ;
dummy :=MemoReplace(Agreement,"[lender]",LenderName) ;
dummy :=MemoReplace(Agreement,"[borroweraddress]",Address);
dummy :=MemoReplace(Agreement,"[lenderaddress]",Address2);
dummy :=MemoReplace(Agreement,"[day]",day(AgreementDate)) ;
dummy :=MemoReplace(Agreement,"[month]",month(AgreementDate)) ;
dummy :=MemoReplace(Agreement,"[year]",year(AgreementDate)) ;
dummy :=MemoReplace(Agreement,"[loan amount text]",AmountSpelt2 );
dummy :=MemoReplace(Agreement,"[loan amount]",LoanAmount );
dummy :=MemoReplace(Agreement,"[borrower]",BorrowerName).
retval := SetGlobal("AgreementNumber", Agreement Number) .
retval := DocumentOpen("LoanAgreementEdit") .

The nifty bit is that DQLs called with ExecDQL (here specifically MemoExecDQL) will have two contexts. The Data cursor context of the DQL and the Form context from the form it is called from. I.e all field/column transactions will be in the DQL context, and the object/gui functions will have the Form context. This is a completely new situation and it is only relevant for new push functions like SetValue(), SetState(),SetColor etc (All Form Context) and old GUI functions like DocumentOpen(), FormOpenRelated() etc,. Functions like MemoMemoCopy(), MemoCopy(), MemoReplace() etc which all have DQL/PRISM context. Any easy way to identify the context is to see if it reference a column/table directly i.e. now quotes or if it reference a form or object (with quotes ""). If we look at the example above (remember thsi is just the DQL for this particular Template, each template can have its own distinctive programming!!!) ;-) define temp "retval" text. -- Just Defines a temp variable we can use to allocate the return value of a function when we call it. You can't call a function in DQL without something to allocate it too.

define temp "retval" text. -- Just Defines a temp variable we can use to allocate the return value of a 
function when we call it. You can't call a function in DQL without something to allocate it too.
for LoanAgreement with Agreement Number=data-entry field1 ; -- Here we basically tell the DQL that we want to 
do transaction on the same table and record as we called it from.
modify records -- then we tell it that we want to modify the data of the current record.
dummy :=MemoMemoCopy(Agreement , any relTemplate Template ,1) ; -- Memofunctions need to have a Record context
and since a Memo function is a manipulative function rather than a function that return a value, it need to be 
called inside the Modify records, and the only way to do that is by allocating the return value to a column, 
dummy, that is just...a dummy the real transaction is the Memo being copied from Tempalte to the internal 
Agreement memo.
dummy :=MemoReplace(Agreement,"[lender]",LenderName) ; -- here we replace the TAG [lender] with the content 
of the field Lendername and the next lines to the same for other tags.
dummy :=MemoReplace(Agreement,"[borroweraddress]",Address);
dummy :=MemoReplace(Agreement,"[lenderaddress]",Address2);
dummy :=MemoReplace(Agreement,"[day]",day(AgreementDate)) ;
dummy :=MemoReplace(Agreement,"[month]",month(AgreementDate)) ;
dummy :=MemoReplace(Agreement,"[year]",year(AgreementDate)) ;
dummy :=MemoReplace(Agreement,"[loan amount text]",AmountSpelt2 );
dummy :=MemoReplace(Agreement,"[loan amount]",LoanAmount );
dummy :=MemoReplace(Agreement,"[borrower]",BorrowerName).
retval := SetGlobal("AgreementNumber", Agreement Number) . -- Here we set a global variable called 
AgreementNumber with the new SetGlobal function with the agreement number for this agreement, this we 
will pick up and use as filter in the LoanAgreementEdit form.
retval := DocumentOpen("LoanAgreementEdit") . -- We could use FormOpenRelated() here directly and that would 
be cool as the relationship &nbsp;context is between the FORM and the new FORM we want to open, rather than 
between the form and the DQL, but here we open a form without a relational restraint and use AgreementNumber 
(global) as filter in the form we open.&nbsp;

You can now keep on editing the document to your heart's content, and when you are happy with the result you can print it and it will be a proper formatted print (PrintMemo()) rather than the normal DataEase for Windows bull.. But you might want to sign it first. Just hit the Sign Agreement button and it copies in a signature.

This one is a little cool too. In itself it is rather straight forward, but because we work in the PRISM/FORM context here too we need the record to be saved before we can manipulate or we can loose data. Problem in Pre-8 DFW is that you can't control the order of functions being called, so you end up with things being "muddled", with the new Wait() function we simply tell the functions to wait a little before they are executed.

Before we did this , it didn't work. The Signature was added but the manual changes was lost, or the manual changes was saved and the signature was ignored... Now it works (you can use much less than one seconds wait is our guess, but what is a second, in a demo at least a dramatic pause is good ;-) It saves the records, waits, Copies the Signature, waits, Saves the new changes....All good! And this is how it looks in Print preview.


Written by DataEase 14/04/13 at 18:49:17 Dataease [{8}]FIVE

dataease 7.2 y 7.1

eldataease 7.2 y 7.1 trabajan en windows de 64 bits ?



Written by eduardo paez 23/04/13 at 02:29:32 DataEase for Windows 7.x
DG3_BlogList