Home » Developer & Programmer » Forms » output from Tlist concatinated???
output from Tlist concatinated??? [message #144981] Sun, 30 October 2005 12:31 Go to next message
ramisy2k
Messages: 150
Registered: April 2005
Senior Member
Hi,

i have this data in a table

sample format is below
ID   Name
1    A 
2    B
3    C
4    D
5    E
.

and so on

I am using the following code to populate the Name column in my non-db Tlist in a Form

DECLARE
RG_NAME_1  VARCHAR2(40) := 'my_data'; 
RG_ID_1    RecordGroup;
ERROR_1    NUMBER;

BEGIN
    RG_ID_1 := FIND_GROUP(RG_NAME_1); 
    IF NOT ID_NULL(RG_ID_1)
THEN
    DELETE_GROUP(RG_ID_1); 
END IF;

    IF ID_NULL(RG_ID_1)
THEN 
RG_ID_1 := CREATE_GROUP_FROM_QUERY(RG_NAME_1, 'SELECT NAME,TO_CHAR(ID)
		                   FROM T ORDER BY 1');
END IF;

ERROR_1 := POPULATE_GROUP(RG_ID_1);

   IF ERROR_1 = 0
THEN
   POPULATE_LIST('block.tlist, RG_ID_1);
END IF;

EXCEPTION
WHEN
   NO_DATA_FOUND
THEN
   NULL;
END;




Well all this is working very fine
my Tlist is populated with 'names' at run time
the problem is that i want to achive 2 things

1. To show the respective clicked Name(s) in a non-database text item and the clicked name is deleted from the tlist. If the user clicks more than one name then the Names in the text item should be concatinated with a comma and a space

For example, if the user clicks 'A' then 'A' should be deleted from tlist and should come in the non-db text item. If the user clicks another element then that element should also be deleted from Tlist and come in the text item as
A, B
and so on..


in the second requirement I want only the ID behind the clicked name should come in another text item and the clicked Name is deleted from the tlist.
Incase of more than one selection the ID's should come concatinated with a comma and a space in the Text item just as explained above..

For exmaple: user clicks 'A', then 'A' should be deleted from the tlist and its ID should come in the text item. On further click the same procedure follow and the next ID comes after the first ID as 1,2
and so on


I would be extremly grateful if somone tells me with example code how to achieved this

regards,
Re: output from Tlist concatinated??? [message #145410 is a reply to message #144981] Wed, 02 November 2005 23:15 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
In the reference manual, research Get_Group_Row_Count, Get_Group_Char_Cell, and Get_Group_Number_Cell. Also look at Delete_Group_Row.

Use the first command to establish your loop, use the second or third command to get the value from the row in group and compare it to the value on the 'checked' row. If it matches then do an :a := :a || ', ' || group_cell value (you will have to handle the first value differently to other values), repeat for second data item. Then use fourth command to remove the row.

David

[Updated on: Wed, 02 November 2005 23:16]

Report message to a moderator

Previous Topic: using check box dynamically at runtime
Next Topic: Interesting ORA-1403 error note for newbies
Goto Forum:
  


Current Time: Fri Sep 20 04:36:58 CDT 2024