Filter Records in WHERE clause iReports using values passed from a prgram

I have searched for iReports manual and what i can see are docs on sale. I have managed to create jrxml file, execute it in jsp and actually view the report.
Now i have a big list of customers from various branches and have various categories. I would like to know how to pass the parameters so that i retrieve a small list of items. e.g. WHERE cu.branch=200 AND cu.category=10. That is i would like to pass 20 and 10 to the jrxml query stored.
In iReports i saw parameters, variables and fields but it seems like these are displayable fields.
How will i achieve this. Am seeking for assistance.
null

>
Please help me to use an associate array in SQL query (WHERE clause).
select *
bulk collect into some_array
>
there is no variable 'some_array' in what you posted.
If you want help with your code you have to post the code you are really using, not some hacked-up version of it that has errors.
Here is sample code that shows how to treat a collection as a table using the TABLE operator
-- type to match emp record
create or replace type emp_scalar_type as object
  (EMPNO NUMBER(4) ,
   ENAME VARCHAR2(10),
   JOB VARCHAR2(9),
   MGR NUMBER(4),
   HIREDATE DATE,
   SAL NUMBER(7, 2),
   COMM NUMBER(7, 2),
   DEPTNO NUMBER(2)
-- table of emp records
create or replace type emp_table_type as table of emp_scalar_type
declare
tb emp_table_type;
deptnoList sys.OdciNumberList;
BEGIN
select emp_scalar_type(empno, ename, job, mgr, hiredate, sal, comm, deptno)
bulk collect into tb from emp;
SELECT deptno bulk collect
INTO deptnoList
FROM dept where deptno not in (select deptno from table(tb));
for i in 1..deptnoList.count loop
dbms_output.put_Line(deptnoList(i));
end loop;
END;Note that tb is a collection and is useds in the subquery 'select deptno from table(tb)'.

Similar Messages

  • How to filter records in EIS drill through using template SQL

    Hi,
    I'm looking for an option to filter records in EIS drill through using Template SQL.
    For eg: If we user runs drill through on 2011, it should restrict display of Jan & Feb and should display records for other months.
    I tried using NOT IN clause, but got an error.
    Can any one help me in understanding how this needs to be defined in template SQL
    Thanks in advance

    Hi Glenn,
    I'm able to filter the records for specific periods.
    However, I'm facing another problem now.
    When I try to run drill through I get 'OLAP_error (1192025): Unknown Error: Not a valid Entry' error.
    This is happening when I include condition as ((($$ab.ACCOUNT_CODE-COLUMN $$) IN ($$Account-VALUE$$)))
    Here, ACCOUNT_CODE is field from Account dimension table and 'Account' is the name of the dimension.
    If I remove this statement and run drill through, it runs but shows data for all accounts (irrespective of the Account selected)resulting in incorrect data.
    Our RDBMS is Oracle. Can you please help me with this
    Thanks

  • Dynamic where clause for MULTIPLE values

    In the following of dynamic where clause?
    i have some somewhat different problem.
    Is a dynamic where clause for multiple values possible?
    If the inputvariable varCode1,varCode2,varCode3,varCode4 are 0 then show all id's otherwise filter the resultset on var1 and/or var2,and/or var3,and/or var4.
    Example table:
    create table t
    (d int,var int);
    insert into t values (1 ,1 );
    insert into t values (2 ,1 );
    insert into t values (3 ,2 );
    insert into t values (4 ,3 );
    insert into t values (5 ,4 );
    insert into t values (6 ,4 );
    insert into t values (7 ,4 );
    insert into t values (8 ,4 );
    insert into t values (9 ,5 );
    insert into t values (10, 6);
    insert into t values (11, 6);
    So what i want to change the where clause upon the value of the varCodes. If var1 and var are not 0 a "AND" should be used otherwise an "OR"
    select id
    from tst
    where var = DECODE( :varCode1, 0, var, :varCode1)
    or/and(?) DECODE( :varCode2, 0, var, :varCode2)
    or DECODE( :varCode3, 0, var, :varCode3)
    or DECODE( :varCode4, 0, var, :varCode4)

    Please turn off your Caps Lock
    and try this link
    Dynamic WHERE clause

  • How to set the where clause of a value set on the basis of a form field

    I am using a DFF(Descriptive FlexField), which needs to display the value of a certain column(say columnA) on the basis of the value of another column(say columnB).
    So i have created a value set which points to the table which has both these columns, and the DFF uses this value set. However, the problem is that I have not put any where clause in the value set, because of which i cannot handle the exact fetch returns more than one rows error.
    The query has to be as follows:
    select ColumnA from tbl where ColumnB = [ a form value ];
    What I want to know is how can i get the value of a certain field of a certain block of the form in the above query.
    Edited by: 981615 on Jan 14, 2013 12:48 AM
    Edited by: 981615 on Jan 14, 2013 12:48 AM

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

  • Where clause is not being passed to the report

    I just upgraded my crystal reports from 10.0 to 11 R2. Reports were working fine in 10.0 version,
    Reports are called from vb.net (vissual studio 2005). When I was running this reports using crystal 10.0 and visual studio 2005, it was working fine, After the upgrade report runs but I am noticing that where clause is not being passed to the reports.It generates report as there is no where clause and produces multiple pages report.

    I believe you are encountering an issue documented in [this|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bip/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do] note.
    Ludek

  • Where does airdrop use contact details from?

    Where does airdrop use contact details from?

    When you attempt to turn on AirDrop from your iPhone, one of the options is "Contacts Only".  I think your question is that when this appears, which device supplies the contact details?
    The answer is that your iPhone (the device you are turning AirDrop on from) supplies the contact details.

  • Where-Clause-Question using "sets of values"

    Hello,
    I'm using 10gR2
    Is it possible to filter rows by using sets of values in the where-clause?
    E.g. like:
    SELECT a, b, c
      FROM mytable
      WHERE (b,c) IN
          (3,4),
          (6,7),
          (9,1),
          (0,2)
        )...should only retrieve rows from mytable with the sets (pairs) of above list

    Here is a link to the docs: [Expression Lists|http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions014.htm#i1033664]
    !http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/img/expression_list.gif!
    The number of expressions in each set must match the number of expressions before the operator in the comparison condition or before the IN keyword in the membership condition.

  • Dimension Mapping in 11g. Can Where clause be used to filter source table?

    Hi,
    Is it possible to use a where clause filter when mapping a dimension to source table in AWM 11g
    My understanding of the user guide is that filters can only be used in cube mapping?
    I am using AWM 11.2.0.1.0A on db 11g R2.
    I presume I could use a database view on the source table to filter down to the records for the dimension, however, I understand this would then prevent me refreshing any cube using this dimension using materialized view refresh?
    Thanks

    Yes, you can apply a where clause on a dimension map, but it is not exposed through AWM. You would need to add an attribute to the XML of the form
    WhereClause='<source table condition>'For example, you could add this to a HierarchyLevelMap.
    <HierarchyLevelMap
      WhereClause="CUSTOMER_DIM.SHIP_TO_ID = 123"
      KeyExpression="CUSTOMER_DIM.SHIP_TO_ID"
      Query="CUSTOMER_DIM">
    </HierarchyLevelMap>Make sure you add it to all relevant levels in a hierarchy. E.g. all levels that share the same source table. This is compatible with MV refresh. You can also map it to a view containing the where clause, and that, too, should work with MV refresh.

  • How to change access path for 'where' clause by using HINTS?

    I searched a loooot of posts and haven't found a solution for my case. I don't even know whether it is possible or not. Is it possible to change the sequence of Oracle "Predicate Information"?
    Here is my SQL and Oracle's execution plan.
      SELECT Max(logId) AS logId FROM online_users_t
      WHERE online_users_date >= to_date('2011-09-19 10:00:00') - 3.2 AND online_users_date <= to_date('2011-09-19 10:00:00') AND online_users_result in (1, -1)
      GROUP BY online_users_user
    | Id  | Operation                    | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                    | 24800 |   629K|  1336   (1)| 00:00:17 |
    |   1 |  HASH GROUP BY               |                    | 24800 |   629K|  1336   (1)| 00:00:17 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID| ONLINE_USERS_T     | 38833 |   985K|  1334   (1)| 00:00:17 |
    |*  3 |    INDEX RANGE SCAN          | ONLINE_USERS_T_IDX |   116K|       |   313   (1)| 00:00:04 |
    Predicate Information (identified by operation id):
       2 - filter("ONLINE_USERS_RESULT"=(-1) OR "ONLINE_USERS_RESULT"=1)
       3 - access("ONLINE_USERS_DATE">=TO_DATE(' 2011-09-16 05:12:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ONLINE_USERS_DATE"<=TO_DATE(' 2011-09-19 10:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'))I have 2 conditions in my 'where' clause, one is date range and the other is 'online_users_result in (1, -1)'. It seems that Oracle filter the table by using 'online_users_result in (1, -1)' first, then access it through date range.
    What I want to do is firstly filtering the table by using date range followed by other things. How can I do it?
    Any clue or help would be highly appreciated.
    Thanks in advance.

    It seems that Oracle filter the table by using 'online_users_result in (1, -1)' first, then access it through date range. No it's not.
    What I want to do is firstly filtering the table by using date range followed by other things. How can I do it?That's precisely what it's doing now.
    It is using the T_IDX index to quickly find all rows that satisfy the range predicate on the date column.
    And then filter those rows to only retrieve the ones that satisfy the other predicate (... in (1,-1)).

  • Where clause as expression value for parameter?

    Is it possible to put a where clause in a expression so I could use as a parameter? I have 3 documents I was going to make as available values, but not sure how to put all of this in the expression. 
    Where clause:
    where document = 'doc1'
    and sentdate = (Select max(sentdate) from Communication where document = 'doc1')

    Hi Lezgettdrunk,
    According to your description, you want to specify available values for a report parameter.
    In Reporting Services, if we want to specify the available values for a report parameter in Report Parameter Properties, we should get those values from specified values or a dataset. When we select the “Specify values” option, we can give each label corresponding
    value. When we select the “Get values from a query” option, we should select a dataset which contains documents values. In your scenario, you could create a dataset with where clause to get document values, then specify parameter available values use this
    dataset.
    Reference:
    Lesson 2: Adding Parameters to Create a List of Available Values (SSRS)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support
    Thank you! This worked for me.

  • Where clause and using dates

    Hi all,
    How to use the where clause to select records based on condition,,,,, and this condition is based on a date,, for example:
    select items from inventory_items
    where purchasing_date in :from_date and :to_date;
    Thank you very much
    Tasneem

    Tasneem wrote:
    Hi all,
    How to use the where clause to select records based on condition,,,,, and this condition is based on a date,, for example:
    select items from inventory_items
    where purchasing_date in :from_date and :to_date;
    Thank you very much
    Tasneemtry this..
    select items from inventory_items
    where purchasing_date between :from_date and :to_date;
    If someone's response is helpful or correct, please mark helpful or correct.

  • Where clause with null values

    I need to have a where clause but either/both of the two attributes compared could be null. How can I make this work, atm it just returns no records even though rows do exist.
    Thanks

    Andrew,
    I think you didn't read correctly what I wrote. I said:
    "Even if a column is unique you still can have several nulls in it"
    So I didnt speak about the case where you have severeal columns in a unique constraint but only ONE.
    SQL> CREATE TABLE tab1 (col1 number);
    Table created.
    SQL> ALTER table tab1 add constraint tab1_col1_uk unique (col1);
    Table altered.
    SQL> INSERT INTO tab1 VALUES (1);
    1 row created.
    SQL> INSERT INTO tab1 VALUES (2);
    1 row created.
    SQL> INSERT INTO tab1 VALUES (2);
    INSERT INTO tab1
    ERROR at line 1:
    ORA-00001: unique constraint (MUELLERMAU.TAB1_COL1_UK) violated
    SQL> INSERT INTO tab1 VALUES (NULL);
    1 row created.
    SQL> INSERT INTO tab1 VALUES (NULL);
    1 row created.
    And even if you have a unique constraint over several columns you can still have more than on records containing only nulls in all fields related to that unique contraint.
    SQL> CREATE TABLE nn (col1 number, col2 varchar2(3));
    Table created.
    SQL> ALTER TABLE nn ADD CONSTRAINT nn_uk UNIQUE (col1, col2);
    Table altered.
    SQL> INSERT INTO nn VALUES (NULL,NULL);
    1 row created.
    SQL> INSERT INTO nn VALUES (NULL,NULL);
    1 row created.
    Regards
    Maurice

  • Mutilple Filter Objects - Changing where clause and or

    Is it possible to have a query as below using filter commands.
    (obj1 = 'value11' and obj2 = 'value21')
    or
    (obj1 = 'value12' and obj2 = 'value22')
    or
    The objective is to manipulate the where clause and , or .
    Thanks in Advance
    Bhanu Mohanty

    Hi Bhanu,
    to reach what you want it's necessary to build a virtual characteristic.
    The new characteristic will be populated via coding during runtime of your query. Another possibility (as mentioned before in this forum by Siegfried Szameitat) is to create a new characteristic in your cube that contains field1 and field2 concatenated. With the first scenario, you don’t need a reloading of your cube, with second one this is necessary.
    Hope this helps.
    Bye,
    Roberto

  • Where clause causes empty values

    Hi All,
    question:
    I have a query where I use a filter for DateTime. If I use it only for one day the query works. But if I change it and expand the period for 2 days, the query just returns a zero velue.
    Could you please explain me how could that be possible?
    Query:
      with
      member [Dimension].[Id].[987] as
        aggregate({
                [Dimension].[Id].&[1234],
                [Dimension].[Id].&[5678],
                [Dimension].[Id].&[9123])
      member [Measures].[MeasureCalculated] as
        ([Measures].[MeasureOriginal], [IsAccepted].[Id].&[1])
    select
      non empty ({[Dimension].[Id].[987]}) on columns,
      ({[Measures].[MeasureCalculated]}) on rows
    from
      [Cube]
    where({[Date].[DateUtc].[Day].&[2014]&[1]&[2] : [Date].[DateUtc].[Day].&[2014]&[1]&[3]})
    Thanks in advance!

    Hi Istvan_Szabo,
    I have tested it on my local environment, the same syntax queery work fine on AdventureWorks cube, which you can see on the screenshot below.
    So in your scenario, the issue can be related to the metedata on your cube, please run the query below and check if the result is correct or not.
    SELECT [Measures].[MeasureCalculated] ON 0,
    [Date].[DateUtc].[Day].MEMBERS ON 1
    FROM
    (SELECT ({[Date].[DateUtc].[Day].&[2014]&[1]&[2] : [Date].[DateUtc].[Day].&[2014]&[2]&[28]}) ON 0
    FROM [CUBE]
    Regards,
    Charlie Liao
    TechNet Community Support

  • HELP: WHERE Clause based on value of the column

    I am selecting from a table as follows and want to have a where condition that is dependent of the value of the column, type of the current row.
    CREATE TABLE tbl (INT id, VARCHAR type, VARCHAR comment)
    I have 3 different values for the type column, EMPLOYEE, CUSTOMER, SUPPLIER. What I want is to have a where clause in my select that is based on the value of type.
    I tried the following but was not successful..
    SELECT * from tbl
    CASE
    WHEN type = 'EMPLOYEE' THEN
    WHERE comment LIKE '%employee%'
    WHEN type = 'CUSTOMER' THEN
    WHERE comment LIKE '%customer%'
    WHEN type = 'SUPPLIER' THEN
    WHERE comment LIKE '%supplier%'
    END
    I am not proficient with stored procedures so if you could please tell me how to do it with straight query, I would greatly appreciated it..
    Thank you,

    Or maybe this:
    SELECT *
      FROM tbl
    WHERE "COMMENT" LIKE
              CASE TYPE
                 WHEN 'EMPLOYEE'
                    THEN '%employee%'
                 WHEN 'CUSTOMER'
                    THEN '%customer%'
                 WHEN 'SUPPLIER'
                    THEN '%supplier%'
              END

Maybe you are looking for