Home » Developer & Programmer » Forms » listitem
listitem [message #266246] Mon, 10 September 2007 04:59 Go to next message
mylapuram
Messages: 8
Registered: April 2007
Location: Bangalore
Junior Member
I am new to D2k. i need your help in populating list dynamically.

this is my scenario.

i have created two static record groups (rg1 & rg2). now based on the value entered in a textbox (text1) i want to populate a listitem with the values from record groups.

ex: if text1 = 1 then
-- populate list with values from rg1
else
-- populate list with values from rg2


Thanks in Advance


mylapuram
Re: listitem [message #266272 is a reply to message #266246] Mon, 10 September 2007 06:14 Go to previous messageGo to next message
amit_vass2000
Messages: 52
Registered: December 2006
Location: Delhi
Member
Hello Dear friend,
To have dynamic list item first you have to do following steps
Suppose you have two record groups rg1 & rg2 then
DECLARE
PR_NO ITEM:=FIND_ITEM('VC_CUSTOMER');
RG_NO1 NUMBER;
RG_NO2 number;
BEGIN

RG_NO1:=POPULATE_GROUP('RG1');
RG_NO2:=POPULATE_GROUP('RG2');
if text1='this' then
POPULATE_LIST(PR_NO,'RG1');
elsif text1='that'
POPULATE_LIST(PR_NO,'RG2');
end if;
END;
Re: listitem [message #266289 is a reply to message #266246] Mon, 10 September 2007 06:44 Go to previous messageGo to next message
mylapuram
Messages: 8
Registered: April 2007
Location: Bangalore
Junior Member
Hi amit,
I am using a static record group. so is there any need to populate the group using 'POPULATE_GROUP'. i tried using your code but i got the error msg 'error populating the group'.

I am also planning to create to separate listboxes with the values i required and dynamically attach one of them based on a condition. is it possible?

Thanks
mylapuram

Re: listitem [message #266453 is a reply to message #266289] Mon, 10 September 2007 23:32 Go to previous message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

Solution of Populating List item in Runtime:

Write this Code under: When_new_form_instnace
--------------------------------------
Declare
R RECORDGROUP; -- Here R is the Variable
status number; -- of Type Recordgroup

Begin
R:=CREATE_GROUP_FROM_QUERY('R','SELECT DISTINCT(PRODUCT_NAME),PRODUCT_NAME FROM PRODUCT_MASTER ');

IF NOT ID_NULL(R) THEN
STATUS:=POPULATE_GROUP(R);
POPULATE_LIST('CONTROL_BLOCK.PLIST',R); --Here PLIST is your
--List name where to
--populate
END IF;
end;

--------------------------------------
i hope the above code will work for you.

Thank you.

[Updated on: Mon, 10 September 2007 23:36]

Report message to a moderator

Previous Topic: FRM-92100 in 10g Forms
Next Topic: Listitem not populating correctly
Goto Forum:
  


Current Time: Tue Dec 06 04:21:36 CST 2016

Total time taken to generate the page: 0.05379 seconds