Easy to Create, Easy to Change - Easy to use!


Problems with different functions in DE9 that doesn't work


Started by Paul Cheeseman
Search
You will need to Sign In to be able to add or comment on the forum!

Problems with different functions in DE9 that doesn't work

The main issue was when we put in the ability to enter multiple adverts from multiple magazines, each of which has its own forms. This required a central “session” file to hold information from these forms, but related to the customer. This eventually caused the 255 relationship error to keep rearing its head, after we got to 8 mags! Whenever you access one form the open relationships spread through all forms.


I have been playing around with some of your functions, and think this issue can be solved with AnyLookup, which I have tied into a couple of descriptive fields for each magazine, so for example Wealden will now only lookup Wealden related, and not check everything. It seems to wor, although I don’t have all data in place yet.

I have also been testing setvar() which seems far superior to setglobal().

Setvalue() on the other hand, I cannot make work so may be missing something.

Example: collect a date from datepicker() and put it into TheDate variable, message result with alert() and setvalue() to a date field or a text field. (this is just a test/play form)

define "x" text .

--x:= ExecDQL("Message /'Hello World!/' window .")

--x:= FormReorganize("*") .

x:=setvar("TheDate",DatePicker()) .

x:=alert(getvar("TheDate"), "Date picked is ") .

x:= setvalue(COUN_Date ,getvar("TheDate")) .

x:= setvalue(COUN_RelName , concat("Date is - ",getvar("TheDate"))) .

x:= wait(4) .

x:=alert("refresh","Now") .

x:=RefreshForm() .

x:=SetFocus("COUN_RelName ") .

As you can see I added random stuff just for fun …

However, SetValue did nothing, and ExecDQL() doesn’t appear to be valid in this build?

None of this is the end of the world, just the next stage in my learning curve.

I have read all the function list, and made notes of several that are going to be useful, hence just adding them randomly here.

There will be a lot more of this as I progress, I hope you don’t mind?

Written by Paul Cheeseman 29/01/20 at 17:23:52 DataEase 9 Developer

AnyLookup()/Timer Event and general info...

Download Sample



The main issue was when we put in the ability to enter multiple adverts from multiple magazines, each of which has its own forms. This required a central ?session? file to hold information from these forms, but related to the customer. This eventually caused the 255 relationship error to keep rearing its head, after we got to 8 mags! Whenever you access one form the open relationships spread through all forms.

This is ?crazy? design.

We are building our new website on top of the old one. The old one had different tables for blog, help, articles, forum etc…

in the new one we put everything in the same table.

You can have many different forms on top of the same table so you can tailor a form to your needs but everything should be stored in a normalised structure.

This way you are much freer in using and re-using stuff.

General rules of design is.

One table for one thing and differentiate through a keyword etc.
If you are having lines, don?t use fields in a form but a subform.

This way you have a properly normalized database.

I?ve never seen the relationship limit exceeded even when I used the original DFD that had only 100 open relationships at the same time.

If you get this message the design is wrong, so the solution is not for us to increase it but for you to re-design ;-) It will also help with speed etc.


I have also been testing setvar() which seems far superior to setglobal().

Setglobal() was a cdf to circumvent the lack of a global variable in Dataeae. SetVar()/GetVar() is a proper function to implement unlimited global variables in a DE app. Not only can you use it to exchange data between different documents/processes but you can even exchange data with other DataEase sessions and even with other products to as there is a command line tool that come with it.

SetVar(?SomeName?,?SomeValue?,?Global?)
GetVar(?SomeName?,?Global?)

SetValue() and GetValue() is to pick a value out of the Active Document.

SetValue() and GetValue() are gui functions and work on the object and not the field.

It is not only a string but as the object model Is case-sensitive it has to be exactly right (not our doing, this is windows).

x:= setvalue(COUN_RelName, concat("Date is - ",getvar("TheDate"))) .

Should be

x:= setvalue("COUN_RelName" , concat("Date is - ",getvar("TheDate"))) .

ExecDQL() works but the problem is escaping and I?m not sure how you executed this DQL, in my test I used the ExecDQL Action on button which has the same problem as you experience.

When you call ExecDQL from an ExecDQL the first execdql will automatically escape the code so your

x:= ExecDQL("Message /'Hello World!/' window .")

Wil in fact be
x:= ExecDQL("Message ?Hello World!? window .") again…

I?ve told the team that we need to fix this on our ExecDQL action then this will not be a problem.

This one doesn?t work because it has a extra space at the end.

x:=SetFocus("COUN_RelName ") .



Here is my version that works.

define "x" text .

--x:= ExecDQL("Message /'Hello World!/' window .")

--x:= FormReorganize("*") .

x:=setvar("TheDate",DatePicker()) .

x:=alert(getvar("TheDate"), "Date picked is ","2000") .

x:= setvalue("COUN_Date" ,getvar("TheDate")) .

x:= setvalue("COUN_RelName" , concat("Date is - ",getvar("TheDate"))) .

--x:= wait(4) .

x:=RefreshScreen() +alert("refresh","Now","4000") +setFocus("COUN_RelName")

You can also observe that I use Alert with an optional timeout, this is quite useful as the code will proceed without user interaction if the user is too slow ;-)

I made a little sample for you (and anyone else that has an interest) where I got your code working and also added a little on AnyLookup and Timer() etc. Just to give you some ideas.

Written by DataEase 29/01/20 at 17:25:45 DataEase 9 Developer