Simplicty and flexibility!


EXECDQL error


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

EXECDQL error

Hi all,

I'm having an error as follows as result of the instruction written in an OML event Mouse exit

retval := ExecDQL(concat("modify records in t_encomendas with idunico = ", chr(34) ,uni,chr(34), "seleccao := ",xvalue,";", "Proposta := ",chr(34),prop,chr(34),";" , "Preco := ", cost ,"." ),"","","","","") .

The field cost is a number and has in this case the value 1,33 .

The error is Dataease Error:

"

... Preco := 1 <!> ,33 .

Terminating '.' missing from the end of a statement "

Can anyone help on it ?

Thanks in advance


Written by afonso santos 12/01/19 at 19:26:50 Dataease [{8}]FIVE

Re:EXECDQL error

"" and , is reserved characters in DE which cause some "funny" problems.

, is used to separate arguments so if you try to use a decimal number it will go wrong as it will be viewed as two numbers.

Originally numbers where nationalised in DE but this was changed from 7.2 onwards. Now all numbers are "English" i.e. decimal seperator is .

This is fine as long as the derivation is "fixed" but with ExecDQL and Actions they can be created "on the fly" as you do here.

The problem here can easily be solved with StringReplace().

However I will give some more general advice too to make it easier to do this in general.

DataEase is developed the same way you guys use it - evolutionary/sequential. When we come up with a new feature/function etc. we first implement/release it and then we learn from it and improve it constantly till we feel its "perfect".

ExecDQL was a great step forward but it came with its own set of problems.

1. " ... This was solved with StringEscape() which is default for all string functions. you can use \' or /' for " (other sequences too).
2. , or other "wrong" characters. StringReplace().

In your case it become extra difficult because you don't take advantage of the fact that ExecDQL has 4 data-entry variables.

retval := ExecDQL("modify records in t_encomendas with idunico = ",data-entry field1,"seleccao := ",data-entry field2,";", "Proposta := ",data-entry field3,";" , "Preco := ", data-entry field4 ,"." ,uni,xvalue,prop,stringReplace(cost,",",".")) .

By playing along with the function we avoid all the problems you experience and on top of that we don't have to use " " in the DQL itself becuase we don't do a concat.

But if you where to do it your way you could simply do this:

retval := ExecDQL(concat("modify records in t_encomendas with idunico = \'",uni, "\' seleccao := ",xvalue,";", "Proposta := \'",prop,"\';" , "Preco := ", stringreplace(cost,",",".") ,"." ),"","","","","") .


Written by DataEase 14/01/19 at 13:21:50 Dataease [{8}]FIVE