forsms2002
14th November 2005, 19:16
Greetings,

I have a Display session (ppmmmx5xxm000) which has main table say ppmmm999. The form attached is a normal
single occurrence+main. I want to add a new button (or in the SPECIFIC menu), by which I want to display text of
a different table say ppmmm222. i.e. the form has ppmmm999.item and whenever, the user clicks on this new "Display Text" button(or goes to specific), the text in ppmmm222 must be displayed in a new window in read-only mode.

Is their any text function available for this ? or i have to create a new form/session and manage is somehow?

Any inputs would be appreciated.

Thanks

mark_h
14th November 2005, 20:08
As long as the users have read-only permissions for the text group it should be possible. What I do for tppss9161m00b is in the after.read section of main.table.io I go and read my table for the text number. The only difference between what you are asking and what I did is that the my users get to create text. What I did was add a text.yn field on the form so the users knew when text was present. The pieces of code below was originally written for a keycode(used for sorting - I think) and later I added a text field. Forgot to mention that I also added this tppss990 text field using the texts button on form 1 of maintain sessions.


choice.text.manager:
before.choice:
| Set the key words for the text.
set_text_attrs()


field.txta.yn:
before.display:
if tppss990.txtn then
txta.yn = tcyesno.yes
else
txta.yn = tcyesno.no
endif


main.table.io:
after.read:
| Get the data to be displayed for the MDD.
get_key_code()

******************************************************************************
| Set the text keyword attributes.
|******************************************************************************
function set_text_attrs()
{
attr.textkw1$ = tppss961.cprj
attr.textkw2$ = tppss961.cspa
attr.textkw3$ = sprintf$("%d",tppss961.sern)

}
|******************************************************************************
| Update the new table if text or a key code is added.
|******************************************************************************
function key_code()
{
select tppss990.*
from tppss990 for update
where tppss990._index1 = {:tppss961.cprj,:tppss961.cspa,:tppss961.sern,:tppss961.seqn,:tppss961.orno,:tppss961.pono,:tppss961.ponb}
selectdo
tppss990.txtn = hold.textn
tppss990.code = key.code
db.update(ttppss990,db.retry)
commit.transaction()
selectempty
tppss990.cprj = tppss961.cprj
tppss990.cspa = tppss961.cspa
tppss990.sern = tppss961.sern
tppss990.seqn = tppss961.seqn
tppss990.orno = tppss961.orno
tppss990.pono = tppss961.pono
tppss990.ponb = tppss961.ponb
tppss990.code = key.code
db.insert(ttppss990,db.retry)
commit.transaction()
endselect
}
|******************************************************************************
| Get the data to display for MDD.
|******************************************************************************
function get_key_code()
{
key.code = ""
tppss990.txtn = 0
select tppss990.*
from tppss990
where tppss990._index1 = {:tppss961.cprj,:tppss961.cspa,:tppss961.sern,:tppss961.seqn,:tppss961.orno,:tppss961.pono,:tppss961.ponb}
selectdo
key.code = tppss990.code
display("key.code")
endselect

}

forsms2002
22nd November 2005, 02:22
Thanks for your input..but i am not getting the desired result
Session
Session type - Display,
Window Type:Modal Window with menu
Main Table - ppmmm999
Form
Form Type - 1(Single occ +main)
Also, I have enabled Text Manager from Form standard commands

Table has a field ppmmm999.txta and field ppmmm222.txtb needs to be displayed.

The code goes like this:
start of code
choice.text.manager:
before.choice:
s.txt.att()
functions:
function s.txt.att()
{
select ppmmm222.*
from ppmmm222
where ppmmm222._index1 = {colon-ppmmm999.item}
selectdo
dummy = text.read
("ppmmm222.txtb,language$,attr.textkw1,attr.textkw2$,
attr.textkw3$,attr.textkw4$,tgroup1,edit_opt1,"abc",0)
endselect
}
end of code
i.e. i am setting the keyword values using text.read. but still the o/p is of ppmmm999.txta (whenever I click on the "T" button)

Any inputs would be appreciated

Juergen
22nd November 2005, 08:33
Use function text.edit instead of text.read

Example:
if text.present.in.language(ppmmm222.txtb, language$) then
dummy=text.edit("ppmmm222.txtb", language$, "", "", "", "", "", "", 1)

The last argument in function text.edit (mode = 1) opens the text only in read-only mode.

Juergen

Juergen
22nd November 2005, 09:21
To use the text function text.edit as stated in my last post is only necessary if you want to display text with a new option/button.

If you work with the standard text functionality (Text Manager) all you have to do is to enter the text field (in your example "ppmmm222.txtb") in "Maintain Sessions" Form1 Option "Text Fields". With "Maintain Available Text Fields by Session" you link text fields to a session.
The text number (in field "ppmmm222.txtb") must be read before you call the text manager.

Juergen