I work with the latest 8.5 release
I work with the latest 8.5 release
I work with the latest 8.5 release
I run this in Execute Function in a button
the problem seems to be the two ExecDQL in one Button. Ist this not working with two?
Or is the second ExecDQL (1:n Positions) not working
PrintDocument()+Wait(0.1)+ExecDQL("for AUFTRAG with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3; Rechnungsnr := blank.",Belegnr,Belegnr2,"LS","","")+Wait(0.1)+ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3; Anzahl := Anzahl * -1.".,Belegnr,Belegnr2,"LS","","")+DocumentClose()+RefreshForm( )
Re:I work with the latest 8.5 release
Not working!
We have discussed it before and if one want a specific qualified answer we need a specific problem that can be recreated. Not working can be anything from typo to serious bug ;-)
Anyhow this is a teaching opportunity!
ExecDQL is completely different environmentally to DQL Documents. An ExecDQL is a property of the active window (as discussed earlier) and as such you can perform things directly on the form etc. from it.
A problem a lot struggle with is FIRING ORDER i.e. that you chain functions together and then they get jumbled as actions like DocumentClose(), RecordSave(), DocumentOpen() etc. are just posted to the WIndows bus and we don't decide the firing order.
the wait() function was created to help with this situation but it is just a help it is not a definite controller.
However there is a way to take complete control of this, do everything in a DQL.
define "retval" text .
retval := PrintDocument() .
retval := ExecDQL("for AUFTRAG with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3; Rechnungsnr := blank.",data-entry field1,data-entry field2, data-entry field3) . -- ExecDQL only need as many arguments you actually use. (vararg)
retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3; Anzahl := Anzahl * -1.".,data-entry field1,data-entry field2, data-entry field3) . -- ExecDQL only need as many arguments you actually use. (vararg)
retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3; Anzahl := Anzahl * -1.",data-entry field1,data-entry field2, data-entry field3) .
retval := DocumentClose() .
retval :=RefreshForm() .
DQL's are executed in command order so you don't have the problem with signals and in an ExecDQL you can manipulate the underlaying form directly from the DQL when you at the same time have all the power of DQL for datamanipulation.
In DE9 this is expanded many 100 if not 1000 of percent, but
In your case I think the real problem was as mentioned before a TYPO.
PrintDocument()+Wait(0.1)+ExecDQL("for AUFTRAG with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3; Rechnungsnr := blank.",Belegnr,Belegnr2,"LS","","")+Wait(0.1)+ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3; Anzahl := Anzahl * -1.".,Belegnr,Belegnr2,"LS","","")+DocumentClose()+RefreshForm( )