Oracle Forms Get Value and Column ( as Parameter to Send ) That I Write the Value Between F11 and Ctrl + F11 for Filtering Tabular List - oracle

I have a tabular list that has two columns (id, name).
I filter tabular list by writing a value between f11 and ctrl + f11. Sometimes I filter it with id, sometimes with name.
After filtering, I push a button. When I push this button I want to get value and column that I wrote this value between f11 and ctrl + f11. Result should be like: ' id:null, name:"Alice" ' or ' id:22, name:"" ' according to which column I fill.
How can I do this?

Huh, doesn't make much sense to me. You see it on the screen when you get the results, don't you?
Anyway: try with GET_BLOCK_PROPERTY built-in, check its ONETIME_WHERE and/or LAST_QUERY properties which will return how the last where clause (or the entire query) looked like.
You'll have to parse it in order to get values you want. It can be done, will require some typing, maybe you'll have to involve a stored procedure and its advanced features such as regular expressions and stuff (which might not be supported by Forms' PL/SQL engine).
Once again: I wouldn't do it, but - if you have & want to - go for it.

Related

Referencing fields in BI Publisher RTF template conditional regions

I'm putting together a report in the BI Publisher Word .rtf plugin with very specific layout needs. One of those needs is the ability to switch company logos depending on parameters entered. I've been using conditional fields to selectively display each logo, but for some reason I can't reference data fields in the conditional code.
I've used these methods:
<?if: column_name = 'desired_value'?> [logo1] <?end if?>
<?choose:?><when: column_name = 'desired_value'?> [logo1] <?end when?>
Both of these methods seem to work when given raw values (i.e. instead of column_name = desired_value, I used 1=1 and it printed) but not when I use the name of the column I'm trying to compare.
For a more concrete example:
<?if: p_jno_in > 0?>
is always false, as if p_jno_in is null rather than having a value. (this variable represents the job number of the report and will never be null, even in my test data/sample xml.)
EDIT: Here is an example of what I've used, and the output.
If you host the image on the server, you can do all sorts of stuff with BI Publisher logic and concatenating an image path string. Make sure you or your DBA makes the path readable by BI Publisher. They can also map it to an FTP connection so you can edit/add images without being in Unix.
Insert any dummy placeholder image in RTF template (Insert Picture)
Right click on image and click “Edit Alt Text” and enter dynamic path. (See below for example)
url:{concat('${OA_MEDIA}/XX_LOGOS',/XML_PATH/LOGO_NAME,'_','small','.jpg')}
Other older versions of Word may have this data stored in the Size/AltText or Format Picture/Web menus
I looked around a bit and found the answer to my question. Turns out I was actually using the correct format the whole time! The issue was actually that I was referencing fields inside a for-each grouping, which I think might limit the scope. So, for example, if my BI Publisher data model has a query block A that has been split into two groups AA and AB, trying to reference a field from AA when you're in a for-each looping on an element from AB will not work.

Best practice for single-valued result in SSRS 2012

I'm new to Reporting Services and using SQL Server Data Tools (Visual Studio 2012). I want to add an item that will display a single value - in this case, the result of a stored procedure call. The value would probably be displayed in the report header.
I've looked at the Tablix data parts that can be added to the report: table, list, and matrix. Not sure which of them, if any, would be appropriate. I could add a parameter item, but it seems that these function as user input choices.
I also looked at a read-only text box, but don't see how to populate it with a query result.
What is the accepted method of adding a single-value result to a report?
If this is to be displayed in the page header, your only option is a textbox; you can't add tablix type parts to page headers/footers.
The textbox expression would be something like:
=First(Fields!MyValue.Value, "DataSet1")
By using an aggregate expression like this you can make sure only one value is returned (even though you might always have only one) and you can also specify the aggregate's Scope; in this case the DataSet you want to query.
If this was going in the report body I would still recommend the same approach, though I wouldn't go so far as to call it best practise, any would work so it's really personal taste.
However, if you had multiple fields returned by the SP but still only one row, in that case I would recommend a table style tablix with one header-level row; easiest to maintain and layout.

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.

Controlling Sorting in SSRS Based Upon a Database Text Field

I've been trying to find a way to even search for this without much luck.
Basically, I've got a text field in a table. All I'm trying to do is check if that text field contains a particular string, in this case, if this field contains either "OLD", "OBSOLETE", or "FOM" and then move it to the very bottom of the list, leaving everything else sorted normally. Is this possible? I'm trying to do this without hitting the SQL Statement itself too much if at all.
You can do this by using a switch statement in the expression/function related to the sort. Logically a switch() is very similar to a case statement.
Under 'sorting options' add a new sort line item (or modify the existing item) by clicking the expression button to the right (Fx)
Then Modify the sort expression similar to this:
=Switch(Fields!YourField.Value="Old","xxx",
Fields!YourField.Value="Obsolete","yyy",
Fields!YourField.Value="Fom","zzz",
1=1,Fields!YourField.Value)
This creates a switch statement that replaces the value to be sorted of the items you mentioned to xxx,yyy, & zzz effectively moving their sort value to the end of the list. Their displayed value will remain the same.
Switch stops evaluating when it finds the first true; so the final 1=1 is basically the otherwise clause that says sort by whatever the actual value of your field is when not old, obsolete, or fom.

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