|
Re: run insert statement from birt [message #718579 is a reply to message #718499] |
Wed, 24 August 2011 17:21 |
|
Magg,
Why not use a stored procedure. For example assume I have a table like:
//example my sql
CREATE TABLE `filetable` (
`filename` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1$$
I can then create a stored proc like:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `writefilename`( IN
p_filename VARCHAR(500))
BEGIN
INSERT INTO filetable
(
filename
)
VALUES
(
p_filename
) ;
SELECT
p_filename;
END
I can then create a stored procedure dataset in BIRT that looks like:
{call writefilename(?)}
The ? will add a parameter which I can set a default value for like:
var loc
=reportContext.getHttpServletRequest().getAttribute("attributeBean").getReportDocumentName();
if( loc == null ){
loc = "No output name";
}else{
loc.substr(0,480);
}
Then drag the dataset to the report canvas and when you run the report
in the viewer the document name should be written to the db. You can
also hide the table that the stored proc is tied to.
Note that is you run in the preview mode the document name will be null.
Jason
On 8/24/2011 10:19 AM, Magg wrote:
> Hi, I need your help. To create my reports, I included the option to
> save the generated file on the server side. But when the user save the
> file on the server, I need to register the name of the file created in
> the DB. I read in a forum that it is possible only implementing a
> servlet because birt can´t send data back to the DB. What other options
> i can implement for achieve this goal?? I need to save the name of the
> file, a description, date of creation, userId... Thanks in advance.
|
|
|
|
|
Re: run insert statement from birt [message #718890 is a reply to message #718636] |
Thu, 25 August 2011 14:38 |
|
Can you try it in the afterFactory?
Jason
On 8/24/2011 6:29 PM, Magg wrote:
> Yesterday, Also I made a Class that insert the data on DB, and I
> imported on birt, on beforerender script. I don´t obtain errors, but the
> info is not inserted on the DB.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03171 seconds