kmcinc
12th March 2016, 01:10
Has anyone ever tried to display text from another table? Say I have a custom table/session with a reference to sales orders and customers. I have the customer number as well as the sales order number. Would it be possible to open the text manager and display the customer or sales order text from tccom010 or tdsls040, respectively?
The only option I can think of is to copy the text numbers to my custom table and open the text manager from there. Any other ideas?
Ajesh
12th March 2016, 13:00
Well you can select the table field and get the text field opened through the command text.edit. Below is little bit about the command
text.edit()
Syntax:
function long text.edit (string text_field, string lang, string kw1, string kw2, string kw3, string kw4, string tgroup, string edit_opt, long mode)
Description
This opens an edit window in which the specified text can be edited. If the text number associated with the specified text (i.e., the value of the field with name text_field) is 0, the text manager prompts the user to confirm whether or not a new text must be created. After editing, the text number is stored in the field with name text_field.
Arguments
string text_field The name of the text field. See Text fields overview. The text number is read from this field, and if that number is 0, the new text number is stored in this field.
string lang The language for which the text is to be edited.
string kw1 Use these arguments to specify the key words for the text.
string kw2
string kw3
string kw4
string tgroup This specifies the name of the text group to which the new text must be assigned. If you specify an empty string here, the text is assigned to the user's default group.
string edit_opt This specifies the type of window in which the text must be displayed.
long mode This species the text mode. Possible values are:
1 read-only
3 read and write
Return values
The text number (0 if there was no text, and the user did not create a new one). Or <0 if an error occured (-1 means 'no permission').
Context
This function is implemented in the 4GL Tools and can be used in all script types.
What you can do is
select tccom010.text
from tccom010
where tccom010._index1 = {:hold.cust}
selectdo
endselect
text.edit("tccom010.text","2","","","","","","",3)
As discussed in the command, it will open an Edit Window.
kmcinc
15th March 2016, 23:59
Ajesh,
Thanks for your response. In my case I display to a user 4 different sources of text:
1. Item Sales Text
2. SO Header Text
3. SO Footer Text, and
4. SO Line Text
The only way I could think of is to add these four sources as table fields. Now the user can press the text button and can choose from the opening window the text he/she likes to see. However, I don't want to allow the user changing this text, I only want to display it. Is there a command to open the text manager in read-only mode?
Ajesh
16th March 2016, 05:18
long mode This species the text mode. Possible values are:
1 read-only
3 read and write
Its the last parameter in text.edit command.
priyank29
16th March 2016, 06:29
Session -> Right click -> go to Text fields
IF here no records then you can add here your fields and here you can see 'write protection' field.
If you tick 'write protection' then this fields becoming 'READONLY' mode.
and here you can also add text fields from another table.