How to force readObejct query with PK value to go to DB?

The default behaviour for read-object queries with a PK value is to use the cache and not go to the database. How can we change this behaviour?
We have cases that a row was deleted by some other process not through toplink, but the corresponding object still in the cache and if you use the readObject query with PK value, the object will be returned as result.
Thanks in advance,

There are several mechanisms to disable caching in TopLink. Note that disabling caching will affect your performance.
In 9.0.4 you can use:
- You can configure you cache type to use a WeakIdentityMap to ensure that only referenced objects are cached.
- On descriptor you can call disableCacheHits() and alwaysRefreshCache() in code or click these options on the Caching/Identity tab in the Mapping Workbench.
- Or to explicitly remove a deleted object from the cache uses session.removeFromIdentityMap(), but you must ensure there are no other objects referencing it.
In 10.1.3 you can also use:
- On descriptor you can call setIsIsolated(true) in code, or select isolated in the Caching tab in the Mapping Workbench.
- Alternatively you can set a CacheInvalidationPolicy on your descriptor to ensure objects are not cached for longer than a specified time, or invalidated daily.
- Or to explicitly invalidate a deleted object use, session.getIdentityMapAccessor().invalidateObject()

Similar Messages

  • How to re-run query with bind values

    Hello,
    I have a sql statement which I obtained from statspack report. After looking at explan plan, I created an idex. Now I want to re-run the query and exame the explan plan again and see if newly created index helped. But how to re-run the query when it contains bind variables? Thank you.

    Have to define and exec them first (if you know the values; null otherwise, so if you can get values, you will have a better idea of what takes place).

  • How could I replace hard coded value in my sql query with constant value?

    Hi all,
    Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
    PROCEDURE class_by_day_get_bin_data
         in_report_parameter_id   IN   NUMBER,
         in_site_id               IN   NUMBER,
         in_start_date_time       IN   TIMESTAMP,
         in_end_date_time         IN   TIMESTAMP,
         in_report_level_min      IN   NUMBER,
         in_report_level_max      IN   NUMBER
    IS
      bin_period_length   NUMBER(6,0); 
    BEGIN
      SELECT MAX(period_length)
         INTO bin_period_length
        FROM bin_data
         JOIN site_to_data_source_lane_v
           ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
         JOIN bin_types
           ON bin_types.bin_type = bin_data.bin_type 
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
       SELECT site_to_data_source_lane_v.site_id,
             site_to_data_source_lane_v.site_lane_id,
             site_to_data_source_lane_v.site_direction_id,
             site_to_data_source_lane_v.site_direction_name,
             bin_data_set.start_date_time,
             bin_data_set.end_date_time,
             bin_data_value.bin_id,
             bin_data_value.bin_value
        FROM bin_data
        JOIN bin_data_set
          ON bin_data.bin_serial = bin_data_set.bin_serial
        JOIN bin_data_value
          ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
        JOIN site_to_data_source_lane_v
             ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
            AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) lane_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'LANE'
                  AND report_parameters.report_parameter_name  = 'LANE'
             ) report_lanes
          ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) class_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'CLASS'
                  AND report_parameters.report_parameter_name  = 'CLASS'
             ) report_classes
          ON bin_data_value.bin_id = report_classes.class_id
        JOIN edr_rpt_tmp_inclusion_table
          ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data_set.start_date_time >= in_start_date_time
         AND bin_data_set.start_date_time <  in_end_date_time
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       =  bin_period_length;
    END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
    bin_data.bin_type            =  2But I dont want any hard coded number or string in the query.
    How could I replace it?
    I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
    bin_type     CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
    Thanks.
    Edited by: user10641405 on May 29, 2009 1:38 PM

    Declare the constant inside the procedure.
    PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
                                        in_site_id             IN NUMBER,
                                        in_start_date_time     IN TIMESTAMP,
                                        in_end_date_time       IN TIMESTAMP,
                                        in_report_level_min    IN NUMBER,
                                        in_report_level_max    IN NUMBER) IS
      bin_period_length NUMBER(6, 0);
      v_bin_type     CONSTANT NUMBER := 2;
    BEGIN
      SELECT MAX(period_length)
        INTO bin_period_length
        FROM bin_data
        JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                           site_to_data_source_lane_v.data_source_id
        JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time >=
             in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time <
             in_end_date_time + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type = v_bin_type
         AND bin_data.period_length <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
      INSERT INTO edr_class_by_day_bin_data
        (site_id,
         site_lane_id,
         site_direction_id,
         site_direction_name,
         bin_start_date_time,
         bin_end_date_time,
         bin_id,
         bin_value)
        SELECT site_to_data_source_lane_v.site_id,
               site_to_data_source_lane_v.site_lane_id,
               site_to_data_source_lane_v.site_direction_id,
               site_to_data_source_lane_v.site_direction_name,
               bin_data_set.start_date_time,
               bin_data_set.end_date_time,
               bin_data_value.bin_id,
               bin_data_value.bin_value
          FROM bin_data
          JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
          JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
                                 bin_data_value.bin_data_set_serial
          JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                             site_to_data_source_lane_v.data_source_id
                                         AND bin_data_set.lane =
                                             site_to_data_source_lane_v.data_source_lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'LANE'
                   AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
                                                                                         report_lanes.lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'CLASS'
                   AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
                                                                                            report_classes.class_id
          JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
                                              TRUNC(edr_rpt_tmp_inclusion_table.date_time)
         WHERE site_to_data_source_lane_v.site_id = in_site_id
           AND bin_data.start_date_time >=
               in_start_date_time - numtodsinterval(1, 'DAY')
           AND bin_data.start_date_time <
               in_end_date_time + numtodsinterval(1, 'DAY')
           AND bin_data_set.start_date_time >= in_start_date_time
           AND bin_data_set.start_date_time < in_end_date_time
           AND bin_data.bin_type = v_bin_type
           AND bin_data.period_length = bin_period_length;
    END class_by_day_get_bin_data;

  • How to create a matrix with constant values and multiply it with the output of adc

    How to create a matrix with constant values and multiply it with the output of adc 

    nitinkajay wrote:
    How to create a matrix with constant values and multiply it with the output of adc 
    Place array constant on diagram, drag a double to it, r-click "add dimension". There, a constant 2D double array, a matrix.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • How to write sql query with many parameter in ireport

    hai,
    i'm a new user in ireport.how to write sql query with many parameters in ireport's report query?i already know to create a parameter like(select * from payment where entity=$P{entity}.
    but i don't know to create query if more than 1 parameter.i also have parameter such as
    $P{entity},$P{id},$P{ic}.please help me for this.
    thanks

    You are in the wrong place. The ireport support forum may be found here
    http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=showcat&catid=9

  • How to create sap query with "or" relationship

    dear experts,
    I need a report to display the employee whoese WSR is
    changed in the month for infotype 0007.
    that is ,we want to search with selection
    begda OR endda between 2008-01-01 and 2008-01-31.
    how to create sap query with "or" relationship?

    hi use like this,
    CALL FUNCTION 'HR_READ_INFOTYPE'
      EXPORTING
        pernr                 =  p_pernr
        infty                   =  '0007'
       BEGDA                =  p_date1
       ENDDA                 = p_date2
      TABLES
        infty_tab             = itab .
    hi use this by passing the pernr to fm and giving the dates low and high in the p_date1 and p_date2.
    loop at itab where condition.
    endloop.
    may it helps u,
    regards,
    venkat.

  • How to map a query with the Multiprovider?

    Hello All,
    Can any one please tell me how to map a query with a multiprovider?
    Appreciate your help.
    Regards,
    Soumya.

    Hi,
    Can you please elaborate , do you mean how to create a query with multiprovider. if that is your question it is very simple just create the query on the multiprovider.
    What is the purpose for mapping the query with multiprovider

  • How to Transpose the Query with following result

    Dear All,
    Can anyone tell me a method of transposing my result of the following query
    Details can be found at
    http://obiee11ge.blogspot.com/2010/07/how-to-transpose-query-with-following.html
    Regards
    Mustafa

    Hi,
    Try this
    Create a combined request with,
    criteria 1 : Dummy, Revenue (Actual),Cogs(Actual), Opex(Actual), PL(Actual)
    in the dummy column fx enter the value as 'Actual'
    criteria 2 : Dummy, Revenue (Yago),Cogs(YAgo), Opex(Yago), PL(Yago)
    in the dummy column fx enter the value as 'Yago'
    criteria 3 : Dummy,Revenue (Budget),Cogs(Budget), Opex(Budget), PL(Budget)
    in the dummy column fx enter the value as 'Budget'
    Now go to the result columns and set the coumn names (Revenue, Cogs, Opex, PL) for the result set.
    For the Dumny remove the column heading.
    In table view you will get the result.
    Thanks,
    Vino

  • How to populate smart form with new values

    Hi!
    I am new to smart form . Can anybody help me in how to populate smart form with some new fileds. Actually i have to populate credit memo form with some customized values..

    Hello,
    Please elaborate your query more in order to be comprehendable.
    Regards,
    Shehryar

  • Apex 3.2 SVG Chart - How to plot Stacked Bar With Negative Values ?

    Currently Apex 3.2 Flash Chart (AnyChart 3.x) does not support Stacked bars with negative values.
    I try with SVG Stacked bars with positive values only, chart ploting works fine. When I add a new series with negative values (i.e -1) and I get a blank Chart region with no error.
    Based on this statement from Apex's documentation:
    *"AxisLine Indicates zero on charts that have negative values."*
    I appreciate your help on how to translate this statement into action ?
    (i.e how to override .Axisline class in CSS section ?)
    Thank you very much for your time.

    User614143,
    try to add the minumm negative value (but positive) to the parameter for the axis.
    e.g. show value+3000 (assuming -3000 is the minimum value)
    If you don't have a limitation for the negative values, it doesn't work. (or try to calculate first the most negative value in a before header process)
    hope this helps.
    Leo

  • How to Display WBS's with Zero values in a report created by CJE2

    Hi All,
    I have created a report using CJE1 (Report painter). When I execute the report, it only shows WBS that have values. How do I display WBS elements that do NOT have values? i.e. display items with zero values. I'm certain there is a setting either within report painter or forms...
    Help appreciated.
    Samir

    Menu>Formatting>Report Layout and then tab Rows. Check if setting under 'Treatment of zero rows' helps.
    Regards
    Sreenivas

  • How to build this query with the minumum number of sub-selects?

    The question I am trying to answer is analogous to this:
    Give me all projects that: (have no employees assigned and are small) or (have only employees with the the last name = "Smith")
    Thanks,
    Roman

    Thank you :
    1- I am in 9.0.4.8 version and can not use allOf expression (availible in beta version)
    2- I not find .notIn(subQuery) operator in 9.0.4.8 version and i replace it by .in(subQuery).not() !
    My new query retrieve Customer who have 0 (zéro) Orders !
    How to retrieve only customer (with orders + with orders without "television") ?
    My new query is :
    <div align="left" class="java">
    <font color="#7f0055"><b>static </b></font><font color="#7f0055"><b>void </b></font><font color="#000000">findCustNoComputer </font><font color="#000000">(){</font>
    <font color="#ffffff">   </font><font color="#000000">ClientSession cs = TopLinkSession.acquireClientSession</font><font color="#000000">()</font><font color="#000000">;</font>
    <font color="#ffffff"></font>
    <font color="#ffffff"></font>
    <font color="#ffffff">  </font><font color="#000000">ReadAllQuery query = </font><font color="#7f0055"><b>new </b></font><font color="#000000">ReadAllQuery</font><font color="#000000">(</font><font color="#000000">Customer.</font><font color="#7f0055"><b>class</b></font><font color="#000000">)</font><font color="#000000">;</font>
    <font color="#ffffff">  </font><font color="#000000">ExpressionBuilder queryBuilder = query.getExpressionBuilder</font><font color="#000000">()</font><font color="#000000">;</font>
    <font color="#ffffff"></font>
    <font color="#ffffff">  </font><font color="#000000">ExpressionBuilder subqueryBuilder = </font><font color="#7f0055"><b>new </b></font><font color="#000000">ExpressionBuilder</font><font color="#000000">(</font><font color="#000000">Customer.</font><font color="#7f0055"><b>class</b></font><font color="#000000">)</font><font color="#000000">;</font>
    <font color="#ffffff">  </font><font color="#000000">ReportQuery subQuery = </font><font color="#7f0055"><b>new </b></font><font color="#000000">ReportQuery</font><font color="#000000">(</font><font color="#000000">Customer.class, subqueryBuilder</font><font color="#000000">)</font><font color="#000000">;</font>
    <font color="#ffffff">  </font><font color="#000000">subQuery.addAttribute</font><font color="#000000">(</font><font color="#2a00ff">&#34;id&#34;</font><font color="#000000">)</font><font color="#000000">;</font>
    <font color="#ffffff">  </font><font color="#000000">subQuery.setSelectionCriteria</font><font color="#000000">(</font><font color="#000000">subqueryBuilder.anyOf</font><font color="#000000">(</font><font color="#2a00ff">&#34;Orders&#34;</font><font color="#000000">)</font><font color="#000000">.anyOf</font><font color="#000000">(</font><font color="#2a00ff">&#34;OrderItems&#34;</font><font color="#000000">)</font><font color="#000000">.get</font><font color="#000000">(</font><font color="#2a00ff">&#34;product&#34;</font><font color="#000000">)</font><font color="#000000">.get</font><font color="#000000">(</font><font color="#2a00ff">&#34;productName&#34;</font><font color="#000000">)</font><font color="#000000">.equal</font><font color="#000000">(</font><font color="#2a00ff">&#34;Computer&#34;</font><font color="#000000">))</font><font color="#000000">;</font>
    <font color="#ffffff">  </font><font color="#000000">query.setSelectionCriteria</font><font color="#000000">(</font><font color="#000000">queryBuilder.get</font><font color="#000000">(</font><font color="#2a00ff">&#34;id&#34;</font><font color="#000000">)</font><font color="#000000">.in</font><font color="#000000">(</font><font color="#000000">subQuery</font><font color="#000000">)</font><font color="#000000">.not</font><font color="#000000">())</font><font color="#000000">;</font>
    <font color="#ffffff"></font>
    <font color="#ffffff">   </font><font color="#000000">Vector allCustomers = </font><font color="#000000">(</font><font color="#000000">Vector</font><font color="#000000">)</font><font color="#000000">cs.executeQuery</font><font color="#000000">(</font><font color="#000000">query</font><font color="#000000">)</font><font color="#000000">;</font>
    <font color="#ffffff">   </font><font color="#000000">Iterator allCustomersIterator = allCustomers.iterator</font><font color="#000000">()</font><font color="#000000">;</font>
    <font color="#ffffff">   </font><font color="#7f0055"><b>while </b></font><font color="#000000">(</font><font color="#000000">allCustomersIterator.hasNext</font><font color="#000000">()) </font>
    <font color="#ffffff">   </font><font color="#000000">{</font>
    <font color="#ffffff">     </font><font color="#000000">Customer tempCustomer = </font><font color="#000000">(</font><font color="#000000">Customer</font><font color="#000000">)</font><font color="#000000">allCustomersIterator.next</font><font color="#000000">()</font><font color="#000000">;</font>
    <font color="#ffffff">        </font><font color="#000000">System.out.println</font><font color="#000000">(</font><font color="#000000">tempCustomer</font><font color="#000000">)</font><font color="#000000">;</font>
    <font color="#ffffff">   </font><font color="#000000">}</font>
    <font color="#ffffff">   </font><font color="#000000">cs.release</font><font color="#000000">()</font><font color="#000000">;</font>
    <font color="#000000">}</font>
    <font color="#ffffff"></font>
    <font color="#ffffff"></font>
    Sql of query :
    SELECT
         t0.CUST_LAST_NAME, t0.CUST_FIRST_NAME, t0.CREDIT_LIMIT, t0.CUST_EMAIL, t0.CUSTOMER_ID, t0.PHONE_NUMBER2, t0.PHONE_NUMBER1, t0.CUST_STREET_ADDRESS1, t0.CUST_CITY, t0.CUST_STREET_ADDRESS2, t0.CUST_STATE, t0.CUST_POSTAL_CODE
    FROM TL_CUSTOMER t0
    WHERE NOT (
         (t0.CUSTOMER_ID IN
              (SELECT DISTINCT t1.CUSTOMER_ID
              FROM TL_CUSTOMER_ORDER t4, TL_ORDER_ITEM t3, TL_PRODUCT t2, TL_CUSTOMER t1
              WHERE (
                   (t2.PRODUCT_NAME = ?) AND
                   ((t2.PRODUCT_ID = t3.PRODUCT_ID) AND
                        ((t3.ORDER_ID = t4.ORDER_ID) AND (t4.CUSTOMER_ID = t1.CUSTOMER_ID)))))))
    Regards

  • Portal Forms - How to make a Field with DEFAULT value NON-EDITABLE by Users

    I HAVE A FORM WITH A DATE FIELD ON IT WITH DEFAULT VALUE.
    THIS IS A TABLE-FIELD.
    I WANT THE FIELD TO BE DISPLAYED ON THE FORM BUT NOT TO ALLOW
    USERS TO EDIT/CHANGE IT.
    HOW CAN I DO THIS?
    TKS IN ADVANCE

    Hi,
    see Re: sequencing problem-Forms
    Regards Michael

  • Query with scalar valued function with date filter

    Hello experts
    i have a problem by filtering my results with the date
    i have written the following code
    SELECT
    T1.ItemCode
    , T1.Dscription
    ,DBO.F_CALCULATION_QUANTITY(T1.ITEMCODE)
    FROM OINV T0 
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OSLP T3 ON T0.SLPCODE=T3.SLPCODE
    WHERE
    (T0.DOCDATE BETWEEN '2010-11-01' AND '2010-11-30')
    and (t2.cardcode ='80022')
    and (T0.CANCELED= 'N')
    group by  t1.itemcode, T1.Dscription, t2.suppcatnum
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go
    ALTER  FUNCTION [dbo].[F_CALCULATION_QUANTITY]
    (@ITEMCODE AS NVARCHAR(10))
    RETURNS
    NUMERIC(19,2)
    AS
    BEGIN
    DECLARE
    @RESULT1 AS NUMERIC(19,2),
    @RESULT2 AS NUMERIC(19,2),
    @RESULT AS NUMERIC(19,2)
    SELECT @RESULT1=SUM(A.QUANTITY)
    FROM INV1 A
    JOIN OINV B ON A.DOCENTRY=B.DOCENTRY
    WHERE A.ITEMCODE=@ITEMCODE
    AND B.DOCDATE BETWEEN  '2010-11-01 00:00:00.000' AND '2010-11-30 00:00:00.000'
    SELECT @RESULT2=SUM(A.QUANTITY)
    FROM RIN1 A
    JOIN ORIN B ON A.DOCENTRY=B.DOCENTRY
    WHERE A.ITEMCODE=@ITEMCODE
    AND B.DOCDATE BETWEEN '2010-11-01 00:00:00.000' AND '2010-11-30 00:00:00.000'
    SELECT @RESULT=ISNULL(@RESULT1,0)-ISNULL(@RESULT2,0)
    --SELECT @RESULT=@RESULT1- @RESULT2
    RETURN @RESULT
    END
    the problem i have is that i want to filter my results accoring to the date provided by the user. i want it to be dynamic query.
    by now, what i do is to edit the docdate in the function in order to get the desired results. this is not what i want.
    could you please help me on this way in order to let the user to input the date?if i add the [%] in the query, it does not bring me the right results

    i have already edited the function to
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go
    ALTER  FUNCTION [dbo].[F_CALCULATION_QUANTITY]
    (@ITEMCODE AS NVARCHAR(10),
    @STARTDATE1 as DATETIME,
    @ENDDATE1 AS DATETIME
    RETURNS
    NUMERIC(19,2)
    AS
    BEGIN
    DECLARE
    @RESULT1 AS NUMERIC(19,2),
    @RESULT2 AS NUMERIC(19,2),
    @RESULT AS NUMERIC(19,2)
    SELECT @RESULT1=SUM(A.QUANTITY)
    FROM INV1 A
    JOIN OINV B ON A.DOCENTRY=B.DOCENTRY
    WHERE A.ITEMCODE=@ITEMCODE
    AND B.DOCDATE BETWEEN (@STARTDATE1) AND (@ENDDATE1)
    SELECT @RESULT2=SUM(A.QUANTITY)
    FROM RIN1 A
    JOIN ORIN B ON A.DOCENTRY=B.DOCENTRY
    WHERE A.ITEMCODE=@ITEMCODE
    AND B.DOCDATE BETWEEN (@STARTDATE1) AND (@ENDDATE1)
    SELECT @RESULT=ISNULL(@RESULT1,0)-ISNULL(@RESULT2,0)
    RETURN @RESULT
    END
    could you please how to edit the query as well?
    i have added the following code and it comes up with the right itemcode but the quantity does not work
    DECLARE
    @ITEMCODE AS NVARCHAR(10),
    @STARTDATE1 as DATETIME,
    @ENDDATE1 AS DATETIME
    SET @STARTDATE1=(SELECT MAX(T0.DOCDATE) FROM oinv t0 WHERE T0.DOCDATE='2010-11-01')
    set @ENDDATE1=(SELECT MAX(T0.DOCDATE) FROM oinv t0 WHERE T0.DOCDATE='2010-11-30')
    SELECT
    T1.ItemCode
    , T1.Dscription
    ,DBO.F_CALCULATION_QUANTITY(@ITEMCODE,@STARTDATE1,@ENDDATE1)
    FROM OINV T0 
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OSLP T3 ON T0.SLPCODE=T3.SLPCODE
    WHERE
    (T0.DOCDATE BETWEEN @STARTDATE1 AND @ENDDATE1)
    and  (t2.cardcode ='80022')
    and (T0.CANCELED= 'N')
    group by  t1.itemcode, T1.Dscription, t2.suppcatnum
    the result is this
    70200     alert1     0.00
    70210     alert2     0.00
    70220     alert3     0.00
    70230     alert4     0.00
    as you can see the quantity is 0 and it shouldnt be
    Edited by: Fasolis Vasilios on Oct 31, 2011 10:49 AM

  • Infoset query with cero values

    Hi
    I have an infoset query that reads the information from an infoset. The infoset query is able to read the values, because it shows me values, but everything is cero, although I have values different from 0.
    But if it didn`t find values it would tell me a different message as "No application data found" or something like this.
    Then the problem is, my infoset read values, but everything that shows me is cero, and that´s not true.
    Thanks and regards
    SEM SEM

    Hi,
    What do you mean with the join condition ?
    I have an infoset query with only one ODS inside. I didn´t want to build a query directly to the ODS as I did´t want to mark the flag available for reporting in the ODS, as it already had very importat data and I didn´t want to damage the ODS  data. That´s why I have built and infoset query with one ODS inside, and in this case I don´t understand the join condition....
    Regards
    SEM SEM
    Does anybody know something ????
    Regards
    SEM SEM
    Message was edited by:
            SEM SEM

Maybe you are looking for