Use this function to translate the \\n characters in a data string created by the MLEInput function. This function translates those characters into whatever characters you want.
MLETranslate (String, ReplaceChar)
Parameter |
Description |
String |
Enter the text string returned from the MLEInput function. |
ReplaceChar |
Enter a text string to replace each set of \\n characters in a returned MLEInput data string. |
The system returns the translated data string for display, storage, or both.
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 occurrences of \\n to \n, which is accepted by multiline variable fields.
Assume the user enters the following text (in double quotes) into the window.
"line 1", Enter key, "line 3", "line 4 ", Entry key, and then "line 6"
Function |
Results |
Explanation |
input_data = MLETranslate (MLEInput ("Enter comments", "Comments Input"), "*"); SetFld (input_data, variable"); |
line 1**line 3*line 4 **line 6 |
After you enter the assumed 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 = MLETranslate (MLEInput ("Enter comments; up to 1024 characters.", "Comments Input", , @(" variable") ), "#"; |
1. Multiline edit window line 1**line 3*line 4 **line 6 2. Input_data line 1 Now is the time. #line 3*line 4 gray area**line 6 |
(Assume this DAL script is executed after the example above.) The window contains the data under item 1. Assuming you deleted the first two asterisks and entered Now is the time. followed by the entry key. Plus added gray area after line 4 and then clicked Ok. The DAL variable, 'input_data', would contain the data under item 2. This example uses an A/N variable field. |
input_data = MLETranslate (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"); |
DAL internal variable line 1 \n\nline 3 \nline 4 \n\nline 6 \n Multiline variable field line 1 blank line line 3 line 4 blank line line 6 |
After entering the assumed information and clicking Ok, the DAL variable, 'input_data', contains the data shown in item 1. The data in the multiline variable, output, would contain 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 \n 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.) After executing the script, the window contains the data shown in item 1. Assuming you entered: Now is the time. for blank line 1 area, and added gray area, after the data 'line 4 ' and then clicked Ok. The DAL internal variable, 'input_data', would contain the data string shown in item 2. The multiline variable field, 'output1', would contain the data shown in item 3. This example uses a multiline variable field. |
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.