Loading items from service into a single select - user-interface

I am using IBM BPM V8.5.7. I want to use a single select to select an item which are retrieved via a service. The problem is that the service returns 10k+ items and I currently use a search function. What I want to achieve basically is to search in the single select dropdown and whilst doing that it must fire the service and return the search results.
I have managed to get the search function working properly but searching through so many items slows down BPM. I've tried using a piece of code but that just cleared the items once the service was called

Your DB-Select probably looks somewhat like this:
SELECT name, value FROM YOURTABLE
This will stress your ibm-control (are you using the classic controls or something else like apex)?
Try to limit the result-set from your SQL-Query. One example could be:
SELECT name, value FROM YOURTABLE FETCH FIRST 100 ROWS ONLY
(be aware this is DB2 style) - in MS SQL this looks like this:
SELECT TOP(100) name, value FROM YOURTABLE

Related

SSRS Dropdown 'Any' Value not working

new to this world so looking for help with what I think wold be a simple thing to fix, however me and the guy who is training me on all that is SQL and SSRS cannot figure this out
I have a report within SSRS and SQL which is working perfectly bar one thing
I have a drop down list parameter which has all our customers names, and the report shows volumes of what that customer has obtained so far etc, and for an individual customer, this works perfectly. However, when trying to see the total volumes by choosing 'Any' from the drop down list, it returns no data, rather than returning everything
Can anyone please advise what I could be missing here, or what I need to show you to help resolve this issue
Cheers
Liam
Assuming you Stored Proc parameter is varchar and represents either customer names or an 'Any' value then the following should work.
SELECT myField1, myField2 -- etc
FROM myTable t
WHERE (t.ClientName = #myParameterName OR #myParameterName = 'Any')
Optionally Please Note: Personally I don't use SPs and usually just put the code to grab the data in the dataset. Some companies don't like you doing this but if you are able to do this I think this makes life easier.
If you can put the stored proc code directly in your dataset query then you can make the report more flexible. You can change your parameter to be MultiValue, you don't need and 'Any' value added to your parameter list either and then you can simply do something like
SELECT myField1, myField2 -- etc
FROM myTable t
WHERE t.ClientName IN(#myParameterName)
SSRS will take all the selected parameter values and inject them into the dataset query correctly, so there is nothing else you need to do. SSRS will also add a 'Select All' option to your parameter in case you want to gran data for everything. The report will work for 1, 2, 10 or all client names.

filter data which doesn't start with list of letters in oracle

I my query dosn't pull any data for this query in Oracle SQL developer can someone help?
SELECT * FROM Customers
WHERE City NOT LIKE '[bsp]%';
You can either use regular expression (advised to avoid for decent size of data as it tends to be considerably slower than the alternate solution using simple like which can even be Sargable sometimes) or use multiple conditions.
Using multiple conditions:
SELECT * FROM Customers
WHERE City NOT LIKE 'b%'
and city not like 's%'
and city not like 'p%';
or using regexp_like:
select *
from customers
where not regexp_like(city, '^[bsp]');

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.

Dropdown with Checkbox in SSRS

I have a report in SSRS which is generated for around 50-60 items.
Say, the report shows Country name on one scale and their population on another.
When the graph is generated, it shows around 100 countries.
If I want to see population of only UK, US, India and China. Then I Should have an option to select the countries of my choice.
Having one dropdown and allowing them to select only one country at a time is simple.
I have no idea on how I can have a checkbox in dropdown to allow multiple selections.
TIA.
You'll want to search for Multi-valued Parameters. If you open the properties of the parameter there will be an option something like "Allow multiple values". Reporting services will handle the UI with checkboxes.
One important thing to know about multi-valued parameters is how to use them in your query. Suppose your parameter #CountryId is being filled with this query:
SELECT CountryId, -- This will be the value for the parameter
CountryName, -- The label for the parameter
FROM Country
If you set this parameter to allow multiple-values, reporting services will generate the multi-select UI for you. When executing any subsequent query that uses the parameter, before sending the query to your SQL server it will replace the parameter with a comma-seperated list of CountryId values. So this query:
SELECT *
FROM MyDataTable
WHERE MyDataTable.CountryId IN (#CountryID)
Will be sent to SQL server as something like this, supposing there are 3 countries selected:
SELECT *
FROM MyDataTable
WHERE MyDataTable.CountryId IN (1001,1002,1003)

What is the best way to integrate Solr as an index with Oracle as a storage DB?

I have an Oracle database with all the "data", and a Solr index where all this data is indexed. Ideally, I want to be able to run queries like this:
select * from data_table where id in ([solr query results for 'search string']);
However, one key issue arises:
Oracle WILL NOT allow more than 1000 items in the array of items in the "in" clause (BIG DEAL, as the list of objects I find is very often > 1000 and will usually be around the 50-200k items)
I have tried to work around this using a "split" function that will take a string of comma-separated values, and break them down into array items, but then I hit the 4000 char limit on the function parameter using SQL (PL/SQL is 32k chars, but it's still WAY too limiting for 80,000+ results in some cases)
I am also hitting performance issues using a WHERE IN (....), I am told that this causes a very slow query, even when the field referenced is an indexed field?
I've tried making recursive "OR"s for the 1000-item limit (aka: id in (1...1000 or (id in (1001....2000) or id in (2001....3000))) - and this works, but is very slow.
I am thinking that I should load the Solr Client JARs into Oracle, and write an Oracle Function in Java that will call solr and pipeline back the results as a list, so that I can do something like:
select * from data_table where id in (select * from table(runSolrQuery('my query text')));
This is proving quite hard, and I am not sure it's even possible.
Things that I can't do:
Store full data in Solr (security +
storage limits)
User Solr as
controller of pagination and ordering
(this is why I am fetching data from
the DB)
So I have to cook up a hybrid approach where Solr really act like the full-text search provider for Oracle. Help! Has anyone faced this?
Check this out:
http://demo.scotas.com/search-sqlconsole.php
This product seems to do exactly what you need.
cheers
I'm not a Solr expert, but I assume that you can get the Solr query results into a Java collection. Once you have that, you should be able to use that collection with JDBC. That avoids the limit of 1000 literal items because your IN list would be the result of a query, not a list of literal values.
Dominic Brooks has an example of using object collections with JDBC. You would do something like
Create a couple of types in Oracle
CREATE TYPE data_table_id_typ AS OBJECT (
id NUMBER
);
CREATE TYPE data_table_id_arr AS TABLE OF data_table_id_typ;
In Java, you can then create an appropriate STRUCT array, populate this array from Solr, and then bind it to the SQL statement
SELECT *
FROM data_table
WHERE id IN (SELECT * FROM TABLE( CAST (? AS data_table_id_arr)))
Instead of using a long BooleanQuery, you can use TermsFilter (works like RangeFilter, but the items doesn't have to be in sequence).
Like this (first fill your TermsFilter with terms):
TermsFilter termsFilter = new TermsFilter();
// Loop through terms and add them to filter
Term term = new Term("<field-name>", "<query>");
termsFilter.addTerm(term);
then search the index like this:
DocList parentsList = null;
parentsList = searcher.getDocList(new MatchAllDocsQuery(), searcher.convertFilter(termsFilter), null, 0, 1000);
Where searcher is SolrIndexSearcher (see java doc for more info on getDocList method):
http://lucene.apache.org/solr/api/org/apache/solr/search/SolrIndexSearcher.html
Two solutions come to mind.
First, look into using Oracle specific Java extensions to JDBC. They allow you to pass in an actual array/list as an argument. You may need to create a stored proc (it has a been a while since I had to do this), but if this is a focused use case, it shouldn't be overly burdensome.
Second, if you are still running into a boundary like 1000 object limits, consider using the "rows" setting when querying Solr and leveraging it's inherent pagination feature.
I've used this bulk fetching method with stored procs to fetch large quantities of data which needed to be put into Solr. Involve your DBA. If you have a good one, and use the Oracle specific extensions, I think you should attain very reasonable performance.

Resources