I need to provide the functionality that, when the user posts sales/purchase order,Posting and Document date default to Workdate and he gets a pop up window with 2 date fields confirming the posting date and document date. Allow the user to change the dates and then update the Posting and Document date on the Header and lines. I get this functionality by using dialog.input, but it comes only with a Cancel button and if the user changes the date then he has to press enter, I cannot give him the OK button. If I call another form with 2 variables, then I face the problem of pasisng the parameters. Is there a solution?
For example: create a report with no DataItem. Set Report Property ProcessingOnly “Yes” and use the request form. There you will find an OK Button. Micha
When you want to use input at runtime it’s much easier to use the mentioned request field of reports, it offers much more flexibility and it’s easier to preset the values of these fields. In yout case you might call this report first (instead of changing the posting function), and then depending on the user entry start the posting codeunit, or change the dates first, and then run the posting codeunit… Saludos Nils
I have used the report method and it is fine, but lately, I have been using an unbound form for that purpose. I then use the : If RUNMODAL.MYFORM = Action::LookupOK then… Bill Benefiel Manager of Information Systems Overhead Door Company firstname.lastname@example.org (317) 842-7444 ext 117
Bills Method is the most flexable and is what navision does with customer credit checks Form 343. The form does not need to be unbound and you can pass what ever information you wish to and from the calling application and your form using subroutines. Paul Baxter
Paul is quite correct (as usual). For my applications, I usually can get away with a simple unbound form. While I am on this subject though, I’ll share a trick: If you create the “Lookup” form as a variable any globals that get populated while the form is ran are still “alive” when the form is closed. To use this: Create a function that has as many arguments as you need to be returned. Make sure that the var value is enabled on each argument. In the function simply transfer the value of each global to the argument. Then in the calling (parent) form, call the function from the form variable. Bill Benefiel Manager of Information Systems Overhead Door Company email@example.com (317) 842-7444 ext 117
If you only want to return a single variable or a series of single variables then you can create a procedure like this Procedure ReturnVal() Decimal EXIT(“GOLBAL VARIABLE TO RETURN”); And once the lookup is done you can call Val:=Myform.ReturnVal; The Form is still live until the variable looses focus (for lacal vars) or is CLEARed Paul Baxter