Analytical query producing different result on joins

Hi,
The queries below should have the same output but the first one just does a left join instead of a full join. Can you please help me figure out why ?
SELECT source_aa, source_bb, COUNT (*)
FROM (SELECT *
FROM (SELECT a_a.application_id,
'In_APPLICATION' AS source_aa,
RANK () OVER (PARTITION BY application_id ORDER BY date DESC) AS rank_aa
FROM application a_a)
WHERE rank_aa = 1) aa
FULL JOIN
(SELECT *
FROM (SELECT b_b.application_id,
'In_APPLICATION_ARCHV' AS source_bb,
RANK () OVER (PARTITION BY application_id ORDER BY date DESC) AS rank_bb
FROM application_archv b_b)
WHERE rank_bb = 1) bb
ON aa.application_id = bb.application_id
GROUP BY source_aa, source_bb;
SELECT source_aa, source_bb, COUNT (*)
FROM (SELECT DISTINCT application_id,'In_APPLICATION' AS source_aa
FROM application) aa
FULL JOIN
(SELECT DISTINCT application_id,'In_APPLICATION_ARCHV' AS source_bb
FROM application_archv) bb
ON aa.application_id = bb.application_id
GROUP BY source_aa, source_bb;
-----

Both your query does a FULL JOIN. But in the first query you have extra filter condition. You are geting only the latest application_id. Check this
<pre>
SELECT *
FROM (
SELECT b_b.application_id
, 'In_APPLICATION_ARCHV' AS source_bb
<font color=red>
, RANK () OVER (PARTITION BY application_id ORDER BY date DESC) AS rank_bb
</font>
FROM application_archv b_b
<font color=red>
WHERE rank_bb = 1
</font>
</pre>
The the code in red is the once thats causing the difference in output.

Similar Messages

  • SQL Query produces different results when inserting into a table

    I have an SQL query which produces different results when run as a simple query to when it is run as an INSERT INTO table SELECT ...
    The query is:
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      The INSERT INTO code:
    TRUNCATE TABLE applicant_summary;
    INSERT /*+ APPEND */
    INTO     applicant_summary
    (  account_number
    ,  main_borrower_status
    ,  num_apps
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      When run as a query, this code consistently returns 2 for the num_apps field (for a certain group of accounts), but when run as an INSERT INTO command, the num_apps field is logged as 1. I have secured the tables used within the query to ensure that nothing is changing the data in the underlying tables.
    If I run the query as a cursor for loop with an insert into the applicant_summary table within the loop, I get the same results in the table as I get when I run as a stand alone query.
    I would appreciate any suggestions for what could be causing this odd behaviour.
    Cheers,
    Steve
    Oracle database details:
    Oracle Database 10g Release 10.2.0.2.0 - Production
    PL/SQL Release 10.2.0.2.0 - Production
    CORE 10.2.0.2.0 Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    Edited by: stevensutcliffe on Oct 10, 2008 5:26 AM
    Edited by: stevensutcliffe on Oct 10, 2008 5:27 AM

    stevensutcliffe wrote:
    Yes, using COUNT(*) gives the same result as COUNT(1).
    I have found another example of this kind of behaviour:
    Running the following INSERT statements produce different values for the total_amount_invested and num_records fields. It appears that adding the additional aggregation (MAX(amount_invested)) is causing problems with the other aggregated values.
    Again, I have ensured that the source data and destination tables are not being accessed / changed by any other processes or users. Is this potentially a bug in Oracle?Just as a side note, these are not INSERT statements but CTAS statements.
    The only non-bug explanation for this behaviour would be a potential query rewrite happening only under particular circumstances (but not always) in the lower integrity modes "trusted" or "stale_tolerated". So if you're not aware of any corresponding materialized views, your QUERY_REWRITE_INTEGRITY parameter is set to the default of "enforced" and your explain plan doesn't show any "MAT_VIEW REWRITE ACCESS" lines, I would consider this as a bug.
    Since you're running on 10.2.0.2 it's not unlikely that you hit one of the various "wrong result" bugs that exist(ed) in Oracle. I'm aware of a particular one I've hit in 10.2.0.2 when performing a parallel NESTED LOOP ANTI operation which returned wrong results, but only in parallel execution. Serial execution was showing the correct results.
    If you're performing parallel ddl/dml/query operations, try to do the same in serial execution to check if it is related to the parallel feature.
    You could also test if omitting the "APPEND" hint changes anything but still these are just workarounds for a buggy behaviour.
    I suggest to consider installing the latest patch set 10.2.0.4 but this requires thorough testing because there were (more or less) subtle changes/bugs introduced with [10.2.0.3|http://oracle-randolf.blogspot.com/2008/02/nasty-bug-introduced-with-patch-set.html] and [10.2.0.4|http://oracle-randolf.blogspot.com/2008/04/overview-of-new-and-changed-features-in.html].
    You could also open a SR with Oracle and clarify if there is already a one-off patch available for your 10.2.0.2 platform release. If not it's quite unlikely that you are going to get a backport for 10.2.0.2.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Filter expression producing different results after upgrade to 11.1.1.7

    Hello,
    We recently did an upgrade and noticed that on a number of reports where we're using the FILTER expression that the numbers are very inflated. Where we are not using the FILTER expression the numbers are as expected. In the example below we ran the 'Bookings' report in 10g and came up with one number and ran the same report in 11g (11.1.1.7.0) after the upgrade and got two different results. The data source is the same database for each envrionment. Also, in running the physical SQL generated by the 10g and 11g version of the report we get different the inflated numbers from the 11g SQL. Any ideas on what might be happening or causing the issue?
    10g report: 2016-Q3......Bookings..........72,017
    11g report: 2016-Q3......Bookings..........239,659
    This is the simple FILTER expression that is being used in the column formula on the report itself for this particular scenario which produces different results in 10g and 11g.
    FILTER("Fact - Opportunities"."Won Opportunity Amount" USING ("Opportunity Attributes"."Business Type" = 'New Business'))
    -------------- Physical SQL created by 10g report -------- results as expected --------------------------------------------
    WITH
    SAWITH0 AS (select sum(case when T33142.OPPORTUNITY_STATUS = 'Won-closed' then T33231.USD_LINE_AMOUNT else 0 end ) as c1,
    T28761.QUARTER_YEAR_NAME as c2,
    T28761.QUARTER_RANK as c3
    from
    XXFI.XXFI_GL_FISCAL_MONTHS_V T28761 /* Dim_Periods */ ,
    XXFI.XXFI_OSM_OPPTY_HEADER_ACCUM T33142 /* Fact_Opportunity_Headers(CloseDate) */ ,
    XXFI.XXFI_OSM_OPPTY_LINE_ACCUM T33231 /* Fact_Opportunity_Lines(CloseDate) */
    where ( T28761.PERIOD_NAME = T33142.CLOSE_PERIOD_NAME and T28761.QUARTER_YEAR_NAME = '2012-Q3' and T33142.LEAD_ID = T33231.LEAD_ID and T33231.LINES_BUSINESS_TYPE = 'New Business' and T33142.OPPORTUNITY_STATUS <> 'Duplicate' )
    group by T28761.QUARTER_YEAR_NAME, T28761.QUARTER_RANK)
    select distinct SAWITH0.c2 as c1,
    'Bookings10g' as c2,
    SAWITH0.c1 as c3,
    SAWITH0.c3 as c5,
    SAWITH0.c1 as c7
    from
    SAWITH0
    order by c1, c5
    -------------- Physical SQL created by the same report as above but in 11g (11.1.1.7.0) -------- results much higher --------------------------------------------
    WITH
    SAWITH0 AS (select sum(case when T33142.OPPORTUNITY_STATUS = 'Won-closed' then T33142.TOTAL_OPPORTUNITY_AMOUNT_USD else 0 end ) as c1,
    T28761.QUARTER_YEAR_NAME as c2,
    T28761.QUARTER_RANK as c3
    from
    XXFI.XXFI_GL_FISCAL_MONTHS_V T28761 /* Dim_Periods */ ,
    XXFI.XXFI_OSM_OPPTY_HEADER_ACCUM T33142 /* Fact_Opportunity_Headers(CloseDate) */ ,
    XXFI.XXFI_OSM_OPPTY_LINE_ACCUM T33231 /* Fact_Opportunity_Lines(CloseDate) */
    where ( T28761.PERIOD_NAME = T33142.CLOSE_PERIOD_NAME and T28761.QUARTER_YEAR_NAME = '2012-Q3' and T33142.LEAD_ID = T33231.LEAD_ID and T33231.LINES_BUSINESS_TYPE = 'New Business' and T33142.OPPORTUNITY_STATUS <> 'Duplicate' )
    group by T28761.QUARTER_YEAR_NAME, T28761.QUARTER_RANK),
    SAWITH1 AS (select distinct 0 as c1,
    D1.c2 as c2,
    'Bookings2' as c3,
    D1.c3 as c4,
    D1.c1 as c5
    from
    SAWITH0 D1),
    SAWITH2 AS (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    sum(D1.c5) as c6
    from
    SAWITH1 D1
    group by D1.c1, D1.c2, D1.c3, D1.c4, D1.c5)
    select D1.c1 as c1, D1.c2 as c2, D1.c3 as c3, D1.c4 as c4, D1.c5 as c5, D1.c6 as c6 from ( select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    sum(D1.c6) over () as c6
    from
    SAWITH2 D1
    order by c1, c4, c3 ) D1 where rownum <= 2000001
    Thank you,
    Mike
    Edited by: Mike Jelen on Jun 7, 2013 2:05 PM

    Thank you for the info. They are definitely different values since ones on the header and the other is on the lines. As the "Won Opportunity" logical column is mapped to multiple LTS it appears the OBI 11 uses a different alogorthim to determine the most efficient table to use in the query generation vs 10g. I'll need to spend some time researching the impact to adding a 'sort' to the LTS. I'm hoping that there's a way to get OBI to use similar logic relative to 10g in how it generated the table priority.
    Thx again,
    Mike

  • Same query giving different results

    Hi
    I m surprised to see the behaviour of oracle. I have two different sessions for same scheema on same server. In both sessions same query returns different results. The query involves some calculations like sum and divisions on number field.
    I have imported this data from another server using export / import utility available with 9i server. Before export every thing was going fine. Is there some problem with this utility.
    I m using Developer 6i as the front end for my client server application. The behaviour of my application is very surprizing as once it shows the correct data and if I close the screen and reopen, it shows wrong data.
    I m really stucked with the abnormal behaviour. Please tell me the possiblities and corrective action for these conditions.
    Regards
    Asad.

    There is nothing uncommitted in both the sessions. But still different results are returned.
    I m sending u the exact query and result returned in both sessions.
    Session 1:
    SQL> rollback;
    Rollback complete.
    SQL> SELECT CC.CREDIT_HRS,GP.GRADE_PTS
    2 FROM GRADE G, COURSE_CODE CC, GRADE_POLICY GP
    3 WHERE G.COURSE_CDE=CC.COURSE_CDE
    4 AND G.SELECTION_ID=45 AND G.GRADE_TYP=GP.GRADE_TYP
    5 AND G.TERM_PROG_ID=17 AND GP.TERM_ID=14
    6 /
    CREDIT_HRS GRADE_PTS
    3 4
    4 3.33
    4 3.33
    3 4
    3 4
    3 4
    3 4
    7 rows selected.
    SQL>
    SESSION 2:
    SQL> rollback;
    Rollback complete.
    SQL> SELECT CC.CREDIT_HRS,GP.GRADE_PTS
    2 FROM GRADE G, COURSE_CODE CC, GRADE_POLICY GP
    3 WHERE G.COURSE_CDE=CC.COURSE_CDE
    4 AND G.SELECTION_ID=45 AND G.GRADE_TYP=GP.GRADE_TYP
    5 AND G.TERM_PROG_ID=17 AND GP.TERM_ID=14
    6 /
    CREDIT_HRS GRADE_PTS
    3 4
    4 3.33
    3 4
    3 4
    3 4
    3 4
    6 rows selected.
    SQL>
    U can see in session 1, seven rows are returned while in session 2 six rows are returned. I have issued a rollback before query to be sure that data in both sessions is same.

  • Formula Node Floor(x) Produces Different Result

    Hi, A search didn't find anything about the Floor(x) function, so... I'm using LabVIEW 6.0.2, and the Floor(x)function in a Formula Node seems to be producing different results depending on previous calculations. I've got the following 2 lines in a Formula Node:
    MSS = Ref / RefDiv;
    MDN = floor(RF / MSS);
    Ref is always 20.0M, RefDiv always 500.0, and for this calcualtion RF is always 1539.4, all numbers Double with 6 digits of precision. I generate an array of frequencies given a start, step, and frequency count. These frequencies then go to a subVI with a Formula Node that calculates the byte values to send to a couple PLLs.
    If Start = 70.1, Step = .025, and Count = 20, at frequency 70.2 the Floor function gives 38.485.
    If Start = 70.0, Step = .025, and Count = 20, at frequency 70.2 the Floor function gives 38.484.
    I've omitted some calc steps here, but I've verified the starting values in the subVI are the same in both cases. Why the result changes I'm hoping someone can tell me...
    Thanks,
    Steve

    I want to thank those involved again for their help. With ideas and hints from others I found a solution without scaling.
    In recap, what had bothered me was it *appeared* like the same subVI was giving correct results one time and incorrect results only randomly. While I understand binary fractional imprecision, I wasn't doing any looped calculations 100+ times or anything.
    I did some more checking though. The problem was indeed introduced by cumulative fractional addition. In this case 10 additions were enought to cause the error. Apparently, floor(71.199_94) produces 72.0. However, using a shift register and constant fraction to add an offset to produce an array introduces enough error in under 10 iterations to be a problem. By the time the loop got to what was supposed to be 72.0, it was actually 71.199_84 or something, enough to throw the floor function. Now I understand why the error occurred, and why it wasn't a problem before.
    I fixed this problem by changing the real frequency number to a I32 before introduction to the formula node. This corrected the error introduced by the fractional addition by forcing 71.199_84 to 72, instead of letting it propagate through the rest of the calculations. And it was a whole lot easier than changing all the VIs to allow scaling! Also, I prefer to know where and why the problem happened, instead of just scaling all my calcualtions. Maybe I can recoginse potential problems in the future.
    My boss wants to go back and look at his program to see if HPVee somehow bypassed the problem or if he did the calculations differently.
    Thanks again for the insight and help,
    Steve

  • Keyboard f keys suddenly producing different results

    Why have my f keys suddenly - middle of workday - started producing different results? The f11 key has changed from increasing sound volume to showing Dashboard. Also, everything I do now produces a sound effect. All my email pages now have black borders. All I have done to the system is to download new ITUNES software. Any help greatly appreciated. I am on an iMac 8.1: 10.5.5.

    Go to:
    http://discussions.apple.com/category.jspa?categoryID=235
    Yvan KOENIG (from FRANCE lundi 6 octobre 2008 13:36:29)

  • Analytic function should produce different results

    Hi All
    My question is derived by a usage of the analytic functions with "sliding window". Let's say you have a table as
    GROUP_ID SEQ VALUE
    1 1 1
    1 1 2
    2 2 3
    2 3 4
    Then the query
    select sum( value ) over ( partition by group_id order by group_id, seq ) from a_table
    should produce different values for different runs because rows 1,2 have the same value of SEQ. One run may produce 2 then 1 another one may produce 1 then 2.
    I need to prove it if the statement above is true. Oracle caches data so if run it several times you will see the same result.
    Thanks.

    Why are you using group_id twice, in partition and order by? And why would several "runs" on the same data provide different results?
    C.

  • Old outer join syntax produces different results from new syntax!

    I have inherited a query that uses the old outer join syntax but that is yielding correct results. When I translate it to the new outer join syntax, I get the results I expect, but they are not correct! And I don't understand why the old syntax produces the results it produces. Bottom line: I want the results I'm getting from the old syntax, but I need it in the new syntax (I'm putting it into Reporting Services, and RS automatically converts old syntax to new).
    Here's the query with the old outer join syntax that is working correctly:
    Code Snippet
    SELECT   TE = COUNT(DISTINCT T1.ID),
             UE = COUNT(DISTINCT T2.ID),
             PE = CONVERT(MONEY, COUNT(DISTINCT T2.ID)) / 
                  CONVERT(MONEY,COUNT(DISTINCT T1.ID))
    FROM     TABLE T1, TABLE T2
    WHERE    T1 *= T2
    In this query, much to my surprise, TE <> UE and PE <> 1. However, TE, UE, and PE seem to be accurate!
    Here's the query with the new outer join syntax that is working but not producing the results I need:
    Code Snippet
    SELECT   TE = COUNT(DISTINCT T1.ID),
             UE = COUNT(DISTINCT T2.ID),
             PE = CONVERT(MONEY, COUNT(DISTINCT T2.ID)) / 
                  CONVERT(MONEY,COUNT(DISTINCT T1.ID))
    FROM     TABLE T1 LEFT OUTER JOIN TABLE T2 ON T1.ID = T2.ID
    Though not producing the results I need, it is producing what would be expected: TE = UE and PE = 1.
    My questions:
    1) Can someone who is familiar enough with the old syntax please help me understand why TE <> UE and PE <> 1 in the first query?
    2) Can someone please tell me how to properly translate the first query to the new syntax so that it continues to produce the results in the first query?
    Thank you very much.

    How can we reproduce the issue?
    Code Snippet
    USE [master]
    GO
    EXEC sp_dbcmptlevel Northwind, 80
    GO
    USE [Northwind]
    GO
    SELECT
    TE
    = COUNT(DISTINCT T1.OrderID),
    UE = COUNT(DISTINCT T2.OrderID),
    PE = CONVERT(MONEY, COUNT(DISTINCT T2.OrderID)) /
    CONVERT(MONEY,COUNT(DISTINCT T1.OrderID))
    FROM
    dbo
    .Orders T1, dbo.Orders T2
    WHERE
    T1
    .OrderID *= T2.OrderID
    SELECT
    TE
    = COUNT(DISTINCT T1.OrderID),
    UE = COUNT(DISTINCT T2.OrderID),
    PE = CONVERT(MONEY, COUNT(DISTINCT T2.OrderID)) /
    CONVERT(MONEY,COUNT(DISTINCT T1.OrderID))
    FROM
    dbo
    .Orders T1
    LEFT OUTER JOIN
    dbo.Orders T2
    ON T1.OrderID = T2.OrderID
    GO
    EXEC sp_dbcmptlevel Northwind, 90
    GO
    Result:
    TE
    UE
    PE
    830
    830
    1.00
    TE
    UE
    PE
    830
    830
    1.00
    As you can see, I am getting same results.
    AMB

  • Same Query returning different result (Different execution plan)

    Hi all,
    To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
    The query :
    SELECT  *
      FROM schema.table@database a
    WHERE     column1 IN ('3')
           AND column2 = '101'
           AND EXISTS
                  (SELECT null
                     FROM schema.table2 c
                    WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
    when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
    Rows     Row Source Operation
          0  NESTED LOOPS  (cr=31 r=0 w=0 time=4894659 us)
       4323   SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
       4336    TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
          0   REMOTE  (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
    Rows     Row Source Operation
       3702  HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
      22556   REMOTE  (cr=0 r=0 w=0 time=401176 us)
       4336   TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
    It'is a bug or i have missed somthing ?
    PS: The two table are no subject to insert or update statement.
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1
    Thanks.

    H.Mahmoud wrote:
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
    9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
    Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version)

  • Oracle function and query return different results

    Hi, I am using oracle 10g database.
    Function is :
    create or replace FUNCTION FUNC_FAAL(myCode number,firstDate date
    *, secondDate date)*
    RETURN INTEGER as
    rtr integer;
    BEGIN
    select count() into rtr*
    from myschema.my_table tbl where tbl.myDateColumn between firstDate and
    secondDate and tbl.kkct is null and tbl.myNumberColumn  = myCode ;
    return (rtr);
    END FUNC_FAAL;
    This function returns 117177 as result.
    But if I run same query in the function seperately ;
    select count()*
    from myschema.my_table tbl
    where tbl.myDateColumn between firstDate and secondDate
    and tbl.kkct is null and tbl.myNumberColumn  = myCode ;
    I get different result 11344 (which is the right one).
    Table and function are in the same schema.
    What can be the problem ?
    Thanks.

    1. i think ur parameter name and Column names are same Firstdate and seconddate try to choose different name
    2. try using Trunc function around your dates
    where trunc(tbl.myDateColumn) between trunc(firstDate) and trunc(secondDate)then compare the result....sometimes time elements comes into play.
    Baig
    [My Oracle Blog|http://baigsorcl.blogspot.com/]

  • XSLT producing different results via debugger and xslt.Transform()

    I'm producing the body of an email via an xsl. I've been having a problem with the html nested inside a <table> tag not displaying correctly. With a bit of help from the good folks over at the asp.net forums, I've tracked the problem down to getting
    different results if I run the xsl via the debugger or via a compiled transform.
    When I debug the xsl it produces
          <table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
            <tr>
              <th width="50%" align="center"><b>Issue</b></th>
              <th width="50%" align="center"><b>Resolution</b></th>
            </tr>
            <tr>
              <td>Missing Acknowledgement date</td>
              <td><p> Test test</p></td>
            </tr>
            <tr>
              <td>Missing Agent and/or Seller signature</td>
        </table>
    And that's absolutely correct and displays perfectly if I save the result as an html file. But when I use xslt.Transform(..), where xslt is a compiled transform, it produces
    <table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
                <tr><th width="50%" align="center"><b>Issue</b></th><th width="50%" align="center"><b>Resolution</b></th></tr>
                <tr>
                    <td>
                        Missing Acknowledgement date
                    </td>
                    <td></td>
                </tr>
            </table>
        </p><p> Test test</p></td></tr><tr>
            <td>Missing Agent and/or Seller signature</td>
            <td>
        </table>
    And to make it even more interesting, that extra </table> tag and the misplaced table data only occur on the first table row, but the table rows are generated by an xsl:for-each.
    The relevant bit of the xsl is:
              <table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
                <tr>
                  <th width="50%" align="center">
                    <b>Issue</b>
                  </th>
                  <th width="50%" align="center">
                    <b>Resolution</b>
                  </th>
                </tr>
                <xsl:for-each select="emailbody/checklist/item">
                  <xsl:if test="string-length(select='issue')>0">
                    <tr>
                      <td>
                        <xsl:value-of select="issue" disable-output-escaping="yes" />
                      </td>
                      <td>
                        <xsl:value-of select="resolution" disable-output-escaping="yes" />
                      </td>
                    </tr>
                  </xsl:if>
                 </xsl:for-each>
              </table>
    The code that generates the compiled transform and the (incorrect) output is:
                Dim xslt As XslCompiledTransform = New XslCompiledTransform(True)
                'Dim xslt As XslTransform = New XslTransform
                xslt.Load(templatePath) 
                Dim objStream As Stream = New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData))
                Dim strbldrXML As StringBuilder = New StringBuilder()
                Dim objXmlReader As XmlReader = XmlReader.Create(objStream)
                Dim objXmlWriter As XmlWriter = XmlWriter.Create(strbldrXML)
                xslt.Transform(objXmlReader, objXmlWriter)
    I've checked that templatePath is pointing to the right file, and the source file I'm debugging the xsl against was copied from the xmlData parameter, so I know the same stuff is getting fed into it.
    I've been chasing this for days, and I'm about ready to quit and go get a job at a fast food joint. I'm not wonderful with xsl in general, or xsl in .NET in particular. Somebody PLEASE tell me I'm doing something stupid....
    Rebecca M. Riordan

    Thanks for the replay, Fred, but that wasn't the problem.
    I still don't know what the problem was, but in putting together a sample for review, I cleaned up the code a little (I inherited this), and while it
    appears to be functionally identical, it's working now. Since we're scheduled to go live on Friday, I'm gonna just take the win ;)
    In the unlikely event that anybody's curious, the original, non-functional code, looked like this:
    Public Function createEmailBody(ByVal templateType As String, ByVal xmlData As String) As String
                Dim templatePath, emailBody As String
                templatePath = Me.templatePath & "\" & templateType & ".xsl"
                Dim xpd As New XPathDocument(New StringReader(xmlData))
                Dim xslt As XslCompiledTransform = New XslCompiledTransform(False)
                xslt.Load(templatePath)
                Dim objStream As Stream = New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData))
                Dim strbldrXML As StringBuilder = New StringBuilder()
                Dim objXmlReader As XmlReader = XmlReader.Create(objStream)
                Dim objXmlWriter As XmlWriter = XmlWriter.Create(strbldrXML)
                xslt.Transform(objXmlReader, objXmlWriter)
                emailBody = strbldrXML.ToString()
                Return emailBody
    End Function
    In cleaning it up, I wrote this:
    Public Function createEmailBody(ByVal templateType As String, ByVal xmlData As String) As String
                Dim xslt As XslCompiledTransform = New XslCompiledTransform(False)
                Dim templatePath As String = Me.templatePath & templateType & ".xsl"
                xslt.Load(templatePath)
                Dim reader As XmlReader = XmlReader.Create(New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData)))
                Dim outSB As StringBuilder = New StringBuilder()
                Dim writer As XmlWriter = XmlWriter.Create(outSB)
                xslt.Transform(reader, writer)
                Dim emailBody As String = outSB.ToString()
                Return emailBody
    End Function
    As I said, they look functionally identical to me, but obviously they're not, because the second one works....
    Rebecca M. Riordan

  • RRI Jumps from Different Characteristics Produce Different Results

    Hi experts,
    I am having the problem that when I jump from different characteristics in the same row in sender query, I got different result sets. E.g. when I choose "Go to" from the "Name" char I got one record, but from "Transaction Description" char multiple records.
    Could anyone please clarify this problem?
    Thanks,
    Joon

    Hi,
    check the info object mapping in RSBBS.   some time same kind of charactorstics is available in the destination report it show such kind of error.  
    Eg.   0customer to 0ship_to_party , or sold to party ect.
    Just go to RSBBS
    select the type as infoobject ...
    Field name   =  target field 
    for more clarification please refer below link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/607e63d5-b56f-2c10-718f-8e33a08baa89?QuickLink=index&overridelayout=true
    regards
    bvr

  • Query Producing Incorrect Results

    Hello:
    I am trying to perform a number of queries on a database and
    although I am not receiving an error message; I know that the
    returned results are incorrect.
    For example, in my test data; I have only 1 record that
    matches the SchoolBoardID (Therefore the record could only have one
    grade, one gender, etc. yet my queries are returning results for
    both genders (Male and Female) and multiple grades (11 and 12) when
    the record in question actually has a grade 9 assignment.
    I have looked at my code over and over and I cannot find
    where the problem is; does anyone see anything that jumps out at
    them?
    I am using an MS-Access database and I have the following
    data types for the relevant fields in question.
    Field Name = SchoolBoardID - Numeric - Sample Data - 74
    Field Name = StudentTraineeGender - Data Type = Text - Sample
    Data - Either Male or Female
    Field Name = StudentTraineeGrade - Data Type = Text - Data
    Contains the following (9, 10, 11, 12, 12+ Hence the reason for
    having to use a Text data type)
    Field Name = SchoolYear - Data Type = Text - Sample Data -
    2006-2007
    Field Name = TradeCode - Data Type = Text - Sample Data -
    444A
    Field Name = TeacherWEAApproval - Data Type = Yes/No - Sample
    Data - 1 or 0
    <!--- Query The Database to find all Grade 11 Males Who
    Are Taking an Apprenticeable Trade --->
    <cfquery name="GetGrade11Males"
    datasource="MyDataSource">
    Select SchoolBoardID, StudentTraineeGender,
    StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
    WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And StudentTraineeGender = 'Male'
    And StudentTraineeGrade = '11'
    And TradeCode <> '0000'
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfGrade11Males =
    #GetGrade11Males.RecordCount#>
    <!--- End Of The Query to find all Grade 11 Males Who Are
    Taking an Apprenticeable Trade --->
    <!--- Query The Database to find all Grade 12 Males Who
    Are Taking an Apprenticeable Trade --->
    <cfquery name="GetGrade12Males"
    datasource="MyDataSource">
    Select SchoolBoardID, StudentTraineeGender,
    StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
    WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And StudentTraineeGender = 'Male'
    And StudentTraineeGrade = '12' Or StudentTraineeGrade =
    '12+'
    And TradeCode <> '0000'
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfGrade12Males =
    #GetGrade12Males.RecordCount#>
    <!--- End Of The Query to find all Grade 12 Males Who Are
    Taking an Apprenticeable Trade --->
    <!--- Query The Database to find all Grade 11 Females Who
    Are Taking an Apprenticeable Trade --->
    <cfquery name="GetGrade11Females"
    datasource="MyDataSource">
    Select SchoolBoardID, StudentTraineeGender,
    StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
    WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And StudentTraineeGender = 'Female'
    And StudentTraineeGrade = '11'
    And TradeCode <> '0000'
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfGrade11Females =
    #GetGrade11Females.RecordCount#>
    <!--- End Of The Query to find all Grade 11 Females Who
    Are Taking an Apprenticeable Trade --->
    <!--- Query The Database to find all Grade 12 Females Who
    Are Taking an Apprenticeable Trade --->
    <cfquery name="GetGrade12Females"
    datasource="MyDataSource">
    Select SchoolBoardID, StudentTraineeGender,
    StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
    WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And StudentTraineeGender = 'Female'
    And StudentTraineeGrade = '12' Or StudentTraineeGrade =
    '12+'
    And TradeCode <> '0000'
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfGrade12Females =
    #GetGrade12Females.RecordCount#>
    <!--- End Of The Query to find all Grade 12 Females Who
    Are Taking an Apprenticeable Trade --->
    <!--- Query To Find The Total Number Of Male Students
    Registered As Apprentices --->
    <cfquery name="GetMaleRegisteredApprentices"
    datasource="MyDataSource">
    <!--- End Of Query To Find The Total Number Of Male
    Students Registered As Apprentices --->
    Select SchoolBoardID, SchoolYear, StudentTraineeGender,
    TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
    TeacherWEAApproval From WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And TradeCode <> '0000'
    And StudentTraineeGender = 'Male'
    And RequestForMTCUByTeacher = 1
    And ApprovedForMTCUByOYAP = 1
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfMaleRegisteredApprentices =
    #GetMaleRegisteredApprentices.RecordCount#>
    <!--- Query To Find The Total Number Of Female Students
    Registered As Apprentices --->
    <cfquery name="GetFemaleRegisteredApprentices"
    datasource="MyDataSource">
    <!--- End Of Query To Find The Total Number Of Female
    Students Registered As Apprentices --->
    Select SchoolBoardID, SchoolYear, StudentTraineeGender,
    TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
    TeacherWEAApproval From WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And TradeCode <> '0000'
    And StudentTraineeGender = 'Female'
    And RequestForMTCUByTeacher = 1
    And ApprovedForMTCUByOYAP = 1
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfFemaleRegisteredApprentices =
    #GetFemaleRegisteredApprentices.RecordCount#>
    <!--- Query To Find The Total Number Of Male Students
    Registered As Apprentices Graduated--->
    <cfquery name="GetMaleRegisteredApprenticesGraduated"
    datasource="MyDataSource">
    <!--- End Of Query To Find The Total Number Of Male
    Students Registered As Apprentices --->
    Select SchoolBoardID, SchoolYear, StudentTraineeGender,
    TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
    Graduated, TeacherWEAApproval From WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And TradeCode <> '0000'
    And StudentTraineeGender = 'Male'
    And RequestForMTCUByTeacher = 1
    And ApprovedForMTCUByOYAP = 1
    And Graduated = 1
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfMaleRegisteredApprenticesGraduated =
    #GetMaleRegisteredApprenticesGraduated.RecordCount#>
    <!--- Query To Find The Total Number Of Female Students
    Registered As Apprentices Graduated--->
    <cfquery name="GetFemaleRegisteredApprenticesGraduated"
    datasource="MyDataSource">
    <!--- End Of Query To Find The Total Number Of Male
    Students Registered As Apprentices --->
    Select SchoolBoardID, SchoolYear, StudentTraineeGender,
    TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
    Graduated, TeacherWEAApproval From WEA_Registrants
    Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
    SchoolYear = '#Form.SchoolYear#'
    And TradeCode <> '0000'
    And StudentTraineeGender = 'Female'
    And RequestForMTCUByTeacher = 1
    And ApprovedForMTCUByOYAP = 1
    And Graduated = 1
    And TeacherWEAApproval = 1
    </cfquery>
    <cfset NumberOfFemaleRegisteredApprenticesGraduated =
    #GetFemaleRegisteredApprenticesGraduated.RecordCount#>
    Thank you for any assistance that you can lend me with
    resolving my query issues:
    Regards,
    Chizzy
    Cornwall, Ontario, Canada

    Hello:
    SchoolBoardID is unique in that there is only 1 record in the
    WEA_Registrants table containing it; however, it was my intention
    with my queries to have the potential for more that one query to
    have a positive recordcount. (i.e. It would be possible for
    #GetGrade11Males.RecordCount# and
    #NumberOfMaleRegisteredApprentices# and
    #NumberOfMaleRegisteredApprenticesGraduated# to all return positve
    record counts.
    quote:
    Sounds like there may be more to this issue than you are
    leading us to believe.
    To the best of my knowledge, I have presented
    all of the relevant information.
    I will look into the documentation on cfqueryparam.
    Thanks for your assistance.
    Regards,
    Chizzy

  • Addition of Key Figures in Query Produces incorrect Results

    Hi,
    I have a query with a globally defined structure of Restricted Key Figures. These are mainly G/L Account Balances from R/3.
    When I create a global Calculated Key Figure the sum is incorrect (ie does not match R/3) despite the fact that the individual restricted key figures match perfectly.
    The only inconsistency is one or 2 of the RKF's are + ve in R/3 but - ve in BW.
    Would really appreciate some help on this.
    Thanks a lot.

    Hi All,
    Thanks for your replies.
    Paul B - I tried your recommendation and it did not work. I only set the result to summation nothing else.
    Bjorn - I tried what you said but that didnt work either.
    Venkat - I thought about this but I have about 30 + Calculated Key Figs and over 100 Restricted Kfs and a fair amount have -ve signs. Do I have to do this for all ?
    Regards

  • Calc producing different results

    I have the following calc. I run the calc through EAS and via a batch file. Wierd thing is that when I run the calc through EAS not all of the accounts aggregate . Thoughts? The time it runs in EAS is 4 sec vs. 40 secs in the batch file.
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET UPDATECALC OFF;
    SET FRMLBOTTOMUP ON;
    SET CACHE HIGH;
    SET AGGMISSG ON;
    SET CALCTASKDIMS 2;
    SET CALCPARALLEL 2;
    FIX("Amount", @RELATIVE(Department,0))
    FIX(@IALLANCESTORS("00914"))
    "All_Programs";
    FIX("All_Programs", "No Program")
         AGG("Accounts");
    ENDFIX
    ENDFIX
    FIX("All_Programs", "No Program")
    @IALLANCESTORS("00914");
    ENDFIX
    ENDFIX
    Any help would be appreciated. We are really stumped here.
    Edited by: kdigman93 on Mar 25, 2009 2:26 PM

    Hi,
    If the same calculation script is run from EAS and from batch file. It will produce the same results without doubt. Request to re check where and which combinatino you are looking at .
    Secondly, when you say the time difference between 4 sec and 40 sec, do also pay attention to other application/load which are consuming the resources of the system at the time,when it had taken 44. This way you can have apples to apples camparision.
    Sandeep Reddy Enti
    HCC
    http://hyperionconsultancy.com/

Maybe you are looking for

  • New iPad 2 does not look as good as old ipad?

    Just got my iPad 2 and first thing I notice is the screen does not look as good as my old iPad.  There's a difference in brightness (dimmer) but that's fine, I just increase the brightness.  However, even after adjusting to approx same level of brigh

  • HT1386 When I plug in my phone it fails to sync

    When I plug my iphone 5 into the mac pro, syncing doesn't start nor does the device show up on iTunes.  Help?

  • Restoring Microsoft Powerpoint from a backup drive.

    Could somone help me? My mac recently ran into some problems... I backed it up via Time Machine then I used Disk Utility to restore it, finally, I re-installed OS X Mountain Lion off the internet using my Apple ID. Now, when I tried to manually drag

  • Poster design with Keynote

    Most people presenting posters at conferences are using Powerpoint. Kinko's and others do accept PPT files for large printing. Also it is easy to define extra large sizes in PPT for a slide, like 80cm x 120cm. I didn't find any option in Keynote to d

  • Showing OCOD reports in a web page

    Is it possible to login into the CRM instance programmatically and navigate to access some of the reports?