Jump to content

BIRT Developer Center Download


Photo
- - - - -

Prepared Statements


  • Please log in to reply
2 replies to this topic

#1 ChristopheXx

ChristopheXx

    Member

  • Members
  • PipPip
  • 19 posts

Posted 13 July 2017 - 01:50 AM

Hi, pardon my ignorance if this is actually simple or/and basic but I am really curious.

 

I stumbled across an old report that my mentor (who already left) wrote. It uses a statement "date(wo.actfinish) between ? and ?" in the script. A little googling about the questions marks led to prepared statements for SQL.

 

However, I still don't really understand how to implement it or how it works. I also tried making a simple report. Testing the SQL in Toad gives me a little prompt to enter an input but it fails to run in BIRT. Can anyone teach me how to implement this? 

 

Thanks.

Attached Files



#2 SoccerMZG

SoccerMZG

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 13 July 2017 - 08:28 AM

Hello Chris,

 

When working a JDBC connection this statement "date(wo.actfinish) between ? and ?" in the dataset query will automatically add dataset parameters. If these parameters have null default values then the preview will not show any data. In my experience, you would link these dataset parameters to report parameters. This replaces (a parameter prompt similar to what you are talking about with toad pops up when you run the report) the "?" with a value. 

The difference with your rptdesign is that you are using scripted datasets, since you are running this through Maximo. Therefore you must create a long string in your script and pass it to Maximo as the variable sqlText. In this case you should replace the "?" with the report parameter like this: "wo.status = '" + params["AddStatus"] + "' " . I took this from your rptdesign. If you are running this report through Maximo, you must make sure that the inputs you select are being passed to the rptparameters.

 

Are you using opensource BIRT or the commercial product? I could send you examples, I just need to know what version you are running.

 

Mark

Attached Files



#3 ChristopheXx

ChristopheXx

    Member

  • Members
  • PipPip
  • 19 posts

Posted 13 July 2017 - 06:07 PM

Hello, thanks for the reply. 

 

I am not sure but I believe I am using the opensource.