web application and BIRT - birt

I am quite new to BIRT.
I ain't getting any basic tutorial to work with BIRT within JSP.
In my application:
The customer will send a parameter, with which a complete report will be generated using information fetched from DB.
Can anyone please help me guide to a tutorial?

First design your report with your query... if you want a particular name from a table ex:
select * from student_name ..like this u have to design your report after that
You have to bind your value i.e what name u wanted u just add like this shown below
url = "$report_url/frameset?__report=ur_report.rptdesign&ur_report_parameter="+query
here the query implies that u have structure your query through javascript or by other means like...
var query = 'where id= '+ur text box id.value ('where id = 1')
in your report u have to add a parameter for this url like(ur_report_parameter)
lastly u have to bind these url parameter from page to ur report parameter for this u have to click on ur dataset and choose script (layout,masterpage,SCRIPT,xmlsource,preview) in that select dropdown to beforeopen and add ur script like this
this.queryText = this.queryText+" "+("ur_report_parameter");
Note : while binding ur query to dataset u have to use (this.queryText) then u will have the result and here u can write ur own javascript...

Related

In oracle apex how to navigate to different pages from link column depending on another column data

I have a table with multiple columns in that one column have data like text field in that data is either A or B and another column is of link type link is getting fetched by id column, Now I have a situation by comparing the data in column1 if it's 'A' I want to navigate to page 3 and If it's 'B' I want to navigate to page 4 by click of link column. How to achieve this?
It would probably be easier for us if you actually shared table and its contents instead of describing it; moreover, as you wrote it as a single sentence with no punctuation, it is difficult to understand what you want to say.
The way I understood it, table is used as a source for some kind of a report (interactive or classic?). One of its (reports) columns is used as a link to another page. As link depends on column's value, I suggest you use a case expression and compose link to target page.
I don't know how you are creating the link now, but - if you already don't use it - have a look at GET_URL function which does most of the dirty job for you. In its simplest appearance, you'd just
select id,
apex_page_get_url(p_page => case when column1 = 'A' then 1
when column2 = 'B' then 2
end) as link
from ...
You need to create Dynamic action on Button.
Button -> True -> Action := Execute server-side-code
Settings -> language := PLSQL
FOR PLSQL QUERY
3)Items to Submit = P7_NEW,P7_NEW_1
4) Items to Return = P31_URL
This will create URL and Trigger the URL to next page

SSRS reports dynamics crm have current record id used as parameter

Hi for my ssrs report In dynamics crm I require that when the report is ran against a certain record, the records passes the record id so that only the relevant results are displayed.
How is this possible ? Steps provided will be great also
Reports are created using SQL.
Run against campaign entity
SSRS reports for CRM have special parameters that enable this for you. To filter by selected records (or the current record you have open) you can utilise a hidden parameter called "CRM_Filtered[Entity]" where entity is the relevant entity you are linking the report to.
In your case, i.e. for the campaign entity, this hidden parameter will be called CRM_FilteredCampaign. For a SQL report this will be a text parameter and will be set to something like this (set by CRM when you run the report)
select campaign0.* from FilteredCampaign as "campaign0"
I do not have a report to hand to check exactly what the SQL will contain, so it might not be exact. But you get the idea. There are several ways to embed this in your report, but you could do so in a rudimentary fashion like this in a dataset:
declare #sql as nVarchar(max)
set #sql = 'SELECT c.campaignid FROM (' + #CRM_FilteredCampaign + ') as c'
exec(#sql)
Expanding on this, i.e. rather than executing text SQL in your main dataset, you can instead simplify the usage by creating a dataset/parameter combo based off the text. In effect, convert the SQL text to a list of values instead.
So add the above SQL to its own DataSet (for this example called DS_FilteredCampaign).
Once you have created DS_FilteredCampaign make sure you click on the Refresh Fields button. Type in the following instead of <null> for the parameter value:
select c.* from FilteredCampaign as c
Once that comes back click on Ok to save the DataSet.
Next, create another hidden text parameter (e.g. Int_FilteredCampaign) and tell it to get its default value from a DataSet (not its available values, its default value). Point the values at DS_FilteredCampaign, and you should be able to select campaignid as its value field. This in effect makes the parameter an array of Ids you can reference in your main DataSet
Now it's much more usable as you can reference it in your SQL something like this in your main DataSet:
select c.*
from FilteredCampaign c
inner join ActivityPointer ap on ...
inner join FilteredAccount a on ...
where c.campaignid in (#Int_FilteredCampaign)
The important piece being where c.campaignid in (#Int_FilteredCampaign)
Summary Steps:
You have a main DataSet called something like dsMain
Create a new parameter called CRM_FiltetedCampaign
Create a DataSet (DS_FilteredCampaign) that executes the SQL passed into CRM_FilteredCampaign
Refresh Fields on the data set to get the campaignid field
Create a text parameter (Int_FilteredCampaign) that retrieves its default value using the new dataset (DS_FilteredCampaign) using campaignid for the value
Reference this new parameter in you dsMain dataset

UFT-API: How to write the output of a select data action to the test's data source

In a uft-api test I have a select data component that returns the query results. The results comeback in an array and I'm trying to figure out how to write the results back to the test's data pane, either excel or local table.
You can use GetDataSource Class of UFT API ,
it will work like this lets say you imported excel from FlightSampleData.xls, and named it as FlightSampleData, you have <input> sheet, accessing the sheet will be like below:
GetDataSource("FlightSampleData!input).Set(ROW,ColumnName,yourValue);
GetDataSource("FlightSampleData!input).Get(ROW,ColumnName);
I recommend you go to help section of UFT , there are many valuable documents that we thought we never had. all the object reference is out there .
this.Dbfetch10.OutputProperties.GetElementsByTagName("EMP_NAME").item(0).InnerText;
Note :-
EMP_NAME - exact field name in database
Dbfetch10- appropriate stepname of the SelectData

BIRT Issue while using MultiSelect List Box

I was supposed to use MultiSelect List Box (Dynamic one) where user can select multiple value (by holding Ctrl key) to see the report.
So while implementing I tried to fetch param value at BeforeOpen method and pass it to DataSet ,append it to where clause using IN operator.I got SQL error on screen. So when I print param value it was something like [Ljava.lang.Object;#26ba26ba] causing error in query. I thought I can't process that multiselect param value in script and pass it to query. So dropped that Idea.
Now I am using BIRT's inbuilt Filter functionality in Data set. What I was doing in SQL using script at Beforeopen Method now i am doing the same in dataset Filter. I used row["dataColumn"]IN param["param"].value and it is working fine. I am able to select one or multiple value from filter screen , execute report and getting proper result.
Now one more thing I need to implement is There should be Select All in filter list box so that instead of selecting any other value user can just select Select All and bring the report for all data. I am passing '%' against Select All. Since I am using IN operator so I am not able to get any data on Report.
I want to provide Select All functionality along with multiselection but not able to do that for above limitations . Alternatively I can use Ctrl+A to select all and it is working also I can do that but this is as per requirement that I need to implement.
I am using BIRT version="3.2.17"
ANY IDEA WILL BE APPRECIATED..Thanks In Advance..:)
Are you able to add a "Select All" option to your parameter choices? I have done this using a union with my parameter query and just adding a 'Select All' to my query results.
Normally what I'll do is add something to my query that will let me easily replace the parameters. Something like:
SELECT myStuff
FROM myTables
/**where**/
You can then modify your DataSet query in your beforeOpen statement.
Something along the lines of:
if(params["myParam"]!='Select All'){
this.queryText=this.queryText.replace("/**where**/","WHERE myStuff IN ('" + params["myParams"].join("','") + "')");
}
This is obviously very simplified, but you should be able to use some form of it to allow what you are asking.

Generate reports in birt using user input. When input is null, everything should be fetched otherwise corresponding data should be shown

I have to create a birt report with user input parameters. It is something like when the para
meter is left blank it should fetch all values from a table otherwise when the user inputs the students roll no.,the corresponding data should be fetched. Can this be done through Birt report? If yes, then please suggest a way.
Thanks!
Yes, you can do that. If the parameter is optional you can't use the Dataset Parameter (with a ? in your query), because it will be null. Instead you have to modify your query using JavaScript.
Create a Report Parameter like usual, in this case 'stud_no'. Then add a comment in your SQL that you are reasonably sure is unique, I use something like --$stud_no$, wherever you want your clause inserted.
Then add a script like this to your Data Set, in beforeOpen:
if (params["stud_no"].value){
this.queryText = this.queryText.replace("--$stud_no$", "and stud_no = " + params["stud_no"]);
}
This replaces the comment with the clause when the parameter has a value. You can use regex in the search string, and then you can also insert it multiple places if you want.
Create your paremater using a like statement
where students_roll_no like ?
Create your report paramater using as a text box, with a defualt value of %
Because the percent '%' is the SQL wildcard, it returns all values. If the user enters a Student Roll number, it returns only that record. Additionally the user can enter 0500% and get all the records that begin 0500.

Resources