Subject Re: [IBO] Master/Detail broken after upgrade
Author Helen Borrie
At 10:20 AM 21/04/2005 -0700, you wrote:

>Greetings,
>I have recently upgraded from 4.2Gb to 4.5B and have found some of my
>reports using TIBOQuery no longer have detail records.
>I am using FB 1.03. Worked perfectly in 4.2Gb.
>
>Any help would be greatly appreciated. It's currently looking like I need
>to go back to 4.2Gb.
>
>
>
>Master SQL:
>
>SELECT
> R.ID, R.USERID, R.COMPANY, R.DIVISION, R.INVLOC, R.INVCOST,
> R.PAIDNOTRECAMT, R.PREINVAMT, (R.OPENORDERAMT * -1) as OPENORDERAMT,
>PI.INVNAME, PI.INVMANTDR,
> T.FULLNAME
>FROM RPT_PI_ANALYSIS R
> LEFT OUTER JOIN PI_MASTER PI ON R.INVLOC=PI.INVLOC
> LEFT OUTER JOIN VW_TRADERS T ON PI.INVMANTDR = T.USERID
>WHERE R.USERID = :USERID AND R.COMPANY = :COMPANY AND R.DIVISION = :DIVISION
>ORDER BY
> PI.INVNAME
>
>
>
>
>Detail SQL:
>
>SELECT
> R.ID, R.USERID, R.COMPANY, R.DIVISION, R.INVLOC, R.ORDERNO,
> R.SUFFIX, R.ORDERID, R.RECTYPE, R.ORDERAMT, OH.ESTAR, OH.CUSTSHIPDUE,
>OH.SELLER, C.CUSTNAME, OH.ESTMARGIN
>FROM RPT_PI_ANALYSIS_DTL R
> LEFT OUTER JOIN ORD_HDR OH ON R.ORDERID = OH.ID
> LEFT OUTER JOIN CUSTOMERS C ON OH.CUSTNO = C.CUSTNO
>WHERE
> R.USERID = :USERID AND R.COMPANY = :COMPANY AND R.DIVISION = :DIVISION AND
>R.INVLOC = :INVLOC
>ORDER BY
> R.ORDERNO, R.SUFFIX
>
>
>
>IBO Monitor:
>/*---
>FETCH
>STMT_HANDLE = 20815000
>FIELDS = [ Version 1 SQLd 12 SQLn 12
> RPT_PI_ANALYSIS.ID = 12002266 <==== master
>record looks great
> RPT_PI_ANALYSIS.USERID = 'KEVIN'
> RPT_PI_ANALYSIS.COMPANY = '01'
> RPT_PI_ANALYSIS.DIVISION = '01'
> RPT_PI_ANALYSIS.INVLOC = '1448'
> RPT_PI_ANALYSIS.INVCOST = 53044.39
> RPT_PI_ANALYSIS.PAIDNOTRECAMT = 0
> RPT_PI_ANALYSIS.PREINVAMT = 0
> [OPENORDERAMT] = -66807.52
> PI_MASTER.INVNAME = 'COOLEY RELOAD'
> PI_MASTER.INVMANTDR = <NULL>
> VW_TRADERS.FULLNAME = <NULL> ]
>----*/
>
>
>
>PREPARE STATEMENT
>TR_HANDLE = 20817256
>STMT_HANDLE = 20815888
>
>SELECT
> R.ID, R.USERID, R.COMPANY, R.DIVISION, R.ORDERNO, R.SUFFIX,
> R.VNDNO, V.VNDNAME, R.APAMT
>FROM RPT_PI_ANALYSIS_AP R
> LEFT OUTER JOIN VENDORS V ON R.VNDNO = V.VNDNO
>WHERE
> R.USERID = ? /* USERID */ AND R.COMPANY = ? /* COMPANY */ AND R.DIVISION
>= ? /* DIVISION */ AND R.INVLOC = ? /* INVLOC */
>ORDER BY R.VNDNO ASC
> , R.ORDERNO ASC
> , R.SUFFIX ASC
>
>PLAN SORT (JOIN (R INDEX (RPT_PI_ANALYSIS_AP_IDX1),V INDEX
>(RDB$PRIMARY313)))
>
>FIELDS = [ Version 1 SQLd 9 SQLn 150
> RPT_PI_ANALYSIS_AP.ID[ID] = <NIL>
> RPT_PI_ANALYSIS_AP.USERID[USERID] = <NIL>
> RPT_PI_ANALYSIS_AP.COMPANY[COMPANY] = <NIL>
> RPT_PI_ANALYSIS_AP.DIVISION[DIVISION] = <NIL>
> RPT_PI_ANALYSIS_AP.ORDERNO[ORDERNO] = <NIL>
> RPT_PI_ANALYSIS_AP.SUFFIX = <NIL>
> RPT_PI_ANALYSIS_AP.VNDNO = <NIL>
> VENDORS.VNDNAME = <NIL>
> RPT_PI_ANALYSIS_AP.APAMT[APAMT] = <NIL> ]
>
>SECONDS = 0.016
>----*/
>/*===
>//>>> STATEMENT PREPARED <<<//
>TIB_Statement.API_Prepare()
>TIBOInternalDataset: "qryAPDtl.IBOqrqryAPDtl" stHandle=20815888
>====*/
>/*---
>DESCRIBE INPUT
>STMT_HANDLE = 20815888
>PARAMS = [ Version 1 SQLd 4 SQLn 4
> < SQLType: 448 SQLLen: 15 > = <NIL>
> < SQLType: 449 SQLLen: 5 > = <NIL>
> < SQLType: 449 SQLLen: 10 > = <NIL>
> < SQLType: 449 SQLLen: 5 > = <NIL> ]
>----*/
>/*---
>EXECUTE STATEMENT
>TR_HANDLE = 20817256
>STMT_HANDLE = 20815888
>PARAMS = [ Version 1 SQLd 4 SQLn 4
> [USERID] = <n> '' <========= Why is this <n> '' ????
>Should be 'KEVIN' from master
> [COMPANY] = '01'
> [DIVISION] = '01'
> [INVLOC] = '1448' ]
>----*/

Actually, it's an empty string. Given that you have been playing about
with the params for this query lately, I would check your datasource
linking, to make sure that a) it is included in the parameter assignments
and b) you don't have an old stray TField around somewhere left over from
your experiments.

A further comment (not material to your current problem and which you
probably don't welcome) is that you have some troublesome redundancies in
those tables - looks like a legacy from Paradox.

Helen