Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Record Group

Status
Not open for further replies.

krindler

Programmer
Jul 16, 2002
39
US
Hello...

Does anyone have any example code of populating a record group with the information selected by a checkbox?

I have a form where a user will enter in a vendor's name. From there, another form will appear displaying the vendor id and vendor name of all vendors in our system that contain what the user entered on the previous form (i.e., if they enter in 'Sprint', the 2nd form will bring back all vendors that contain 'Sprint' in their vendor name). There is also a checkbox next to each vendor on the 2nd form.

From this point, the user will go and select the vendors (by checking the checkbox) that he or she wants the report run for. Once they have selected all of the vendors, they will click on a button that will insert data into Excel.

Does anyone have any help they could give me on this problem? I am hoping to create a record group from the data they check, and then run the report off of the data in the record group.

Thanks In Advance!!
 
Try something like this on the report button:

DECLARE
l_rg RECORDGROUP := Find_Group('VENDORS');
l_col GROUPCOLUMN := Find_Column('VENDORS.VENDOR');
l_row NUMBER;
BEGIN
IF Id_Null(l_rg)
THEN
l_rg := Create_Group('VENDORS');
l_col := Add_Group_Char_Cell(l_rg,'VENDOR',CHAR_COLUMN,50);
END IF;
--
Delete_Group_Row(l_rg,ALL_ROWS);
Go_Block('<vendor block>');
First_Record;
--
LOOP
IF :block.checkbox = 'Y'
THEN
l_row := l_row + 1;
Add_Group_Row(l_rg,END_OF_GROUP);
Set_Group_Char_Cell(l_col,l_row,:block.vendor);
END IF;
--
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
Down;
END LOOP;
--
-- call report and pass record group VENDORS
END;

 
Oops. In the DECLARE section change this:

l_row NUMBER := 0;
 
Hello...

I am back again. Thanks for your help. I got the above to work in my form, but now I was hoping you could help me a little bit more. From here, I would like to take the vendor information in the record group and insert it into Excel. Do you have any sample code you could help me with along those lines?

Thanks!!
 
You could copy the record group into a text item, with each column seperated with a comma and each record with a carriage return (chr(10)). Then do a SELECT_ALL; followed by COPY_REGION;. This will copy the item's data into the local clipboard. Then simply start Excel and hit ctrl-V. You will need to make the text item quite large.

This will only work in client forms, not web forms.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top