Thursday, May 28, 2015

Obtaining Input Without Form


Hi,

Sometimes you don't want to use an entire form to get user input. In this case, we use dialog box window before opening the main form to give input and according to given input we can open form. As we know dialog boxes are not a substitute for forms, but they work just fine for quick input to our form.

Now I am going to implement a simple form as our requirement that open a window before opening the main form to take input.

1) Create a new form named "Input Window Before Main Form" and select some fields according to you. You can also use another name.

2) Form Designer look like this...


3) Add the following global variables...
Name DataType Subtype Length
Window Dialog
DocumentType Option
DocumentNo Code 20

Note: Remember that "DocumentType" is an option datatype. So use the correct option. Select the DocumentType and press "SHIFT+F4" to go to its properties and under the "OptionString" properties write the correct value.

4) Add the Text Constants...
Name ConstValue
Text001 Document Type: #1############# \Document No.:  #2#############

5) Now write the following code to the "OnOpenForm" trigger of the form...
Window.OPEN(Text001);
Window.INPUT(1,DocumentType);
Window.INPUT(2,DocumentNo);
Window.CLOSE;

SETRANGE("Document Type",DocumentType);
SETRANGE("No.",DocumentNo);

6) Now save and close the form and run. When you run your form then "Input Window" will open first.


7) After giving the input press Enter or click Cancel to exit.



Thanks & Regards
Niraj Kumar

http://niraj-msnav.blogspot.com
http://nirajdynamicsnav.wordpress.com

    

No comments:

Post a Comment