Use this function to create a window with a title, prompt message, and a place for a user to enter multiple lines of text, such as the one shown here:
This function creates a window you can use to gather information from a user. The text entered through this window is returned as a string. If no text is assigned, or if the user closes the window by clicking on Cancel, the returned string will be empty.
MLEInput (Prompt, Title, Length, DefText)
Parameter |
Description |
Prompt |
Enter a text string to assign as the prompt for the field |
Title |
Enter a text string to assign as the title of the window. |
Length |
Enter the maximum input text length. The default is 1024. |
DefText |
Enter a text string to assign as the default input data. |
If the user presses Enter to type on a new line, the system replaces the new line character with a \\n when it returns the text. You can leave the result like this, so you know where the line breaks are supposed to be, or you can send it to the MLETranslate function, which will translate the \\n into whatever characters you want.
Multiline variable fields cannot accept the data captured by the MLEInput function without the data first being translated. Before you assign the output from a MLEInput function to a multiline variable field, you should do the following.
VALUE = MLETranslate (VALUE, "\n");
Where VALUE represents the text returned from the MLEInput statement. This will change all of the \\n occurrences to \n, which is accepted by multiline variable fields.
Assume the user enters the following text (in quotes) into the window:
"line 1", Enter key, "line 3", "line 4", Entry key, and then "line 6"
Function |
Results |
Explanation |
input_data = MLEInput ("Enter comments; up to 1024 characters.", "Comments Input"); SetFld (input_data, variable"); |
line 1\\n\\nline 3\\nline 4\\n\\nline 6 |
After you enter the information and click Ok, the DAL variable, 'input_data', contains the string in the result column. This example uses an A/N variable field. |
input_data = MLEInput ("Enter your comments.", "Comments Input", , @(" variable") ); |
1. Window: line 1 blank line 1 line 3 line 4 blank line line 6 2. Input_data line 1\\nNow is the time\\nline 3\\nline 4 gray area\\n\\nline 6 |
(Assume this DAL script is executed after the example above.) The window would contain the data under item 1. If you enter: - Now is the time in blank line 1 - gray area: after 'line 4 ' and click Ok. The DAL variable, 'input_data', will contain the string under item 2. This example uses an A/N variable field. |
input_data = MLEInput ("Enter comments; up to 1024 characters.", "Comments Input"); |
Null string |
Assume you clicked Ok or Cancel without entering any data. The system stores a null string in the variable. |
input_data =MLETranslate (MLEInput ("Enter comments; up to 1024 characters.", "Comments Input"), "\n"); SetFld (input_data, "output"); |
1. DAL internal variable line 1\n\nline 3\nline 4\n\nline 6 2. Multiline variable field, output: line 1 blank line line 3 line 4 blank line line 6 |
After you enter the assumed information and click Ok, the DAL variable, 'input_data', contains the string shown in item 1. The data in the multiline variable field, output, contains six lines, as shown in item 2. This example uses a multiline variable field. |
input_data = MLETranslate (MLEInput ("Enter comments; up to 1024 characters.", "Comments Input", , @("output") ), "\n"); SetFld (input_data, "output1"); |
1. Window line 1 blank line line 3 line 4 blank line line 6 2. Input_data line 1\nNow is the time\nline 3\nline 4 gray area\n\nline 6 3. Multiline variable output1: line 1 Now is the time line 3 line 4 gray area blank line line 6 |
(Assume this DAL script is executed after the example above.) The window contains the data under item 1 after the DAL script is executed. Assuming you entered: - Now is the time in blank line 1 - gray area after the data 'line 4 ' and then clicked Ok, the DAL internal variable, 'input_data', contains the string shown in item 2. The multiline variable field, output1, contains the data shown in item 3. This example uses a multiline variable field. |
© Copyright 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices