on 09-27-2012 11:24 PM
Hello.
I'd like to make a report from a query I've already made, the problem is with the parameters, I know how to put parameters in Crystal but not the parameters inside a left join clause, here is the query:
SELECT DISTINCT T0.CardCode,
T0.U_CR CR,
T0.Name Tienda,
T0.U_CIUDAD Ciudad,
T0.Address Direccion,
T1.U_fecha
T1.U_hora
T1.U_Proveedor
ISNULL(T4.firstName,'') + ' ' + ISNULL(t4.middleName,'') + ' ' + ISNULL(t4.lastName,'') Tecnico,
T5.descript Zona,
isnull(T1.callID,0) AS 'ID llamada'
FROM OCPR T0
LEFT JOIN OSCL T1 ON T0.CntctCode = T1.contctCode
AND T1.U_Fecha >= [%0] AND T1.U_Fecha <= [%1]
AND T1.origin = 3 AND T1.callType = 36 AND T1.problemTyp = 5
LEFT JOIN OINS T2 ON T1.insID = T2.insID
LEFT JOIN CRD1 T3 ON T3.CardCode = T0.CardCode
LEFT JOIN OTER T5 ON T5.territryID = T2.territory
LEFT JOIN OHEM T4 ON T4.empID = T1.technician
Where
T0.CardCode = '[%2]' AND
T0.U_CR IS NOT NULL
ORDER BY
isnull(T1.callID,0)
This is the query that I use in SAP B1, how can I add the T1.U_Fecha parameters to Crystal, because If I use them in the Where clause its gonna mess the results.
Thanks in advance hope you can help me.
Hi,
This part in the Join portion has to be in the where clause:
AND T1.U_Fecha >= [%0] AND T1.U_Fecha <= [%1]
AND T1.origin = 3 AND T1.callType = 36 AND T1.problemTyp = 5
After you add the query through the Add Command window, just create two parameters. You can call it Start and End. I'm assuming the parameters are of string type. You can the add them to the query placing the cursor after ">=" and double-clicking the parameter name (Start) on the top-right and you would get this:
AND T1.U_Fecha >= {?Start} AND T1.U_Fecha <= {?End}
Hope this helps!
- Abhilash
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Firstable, thanks for your help, but I think you misunderstood my request I know how to add parameters in the Where clause, what I want to do is to add the parameters in the left join clause, the query gives me completely different results if I place them in the where clause, hope you can help me.
Regards.
Exactly in this part:
LEFT JOIN OSCL T1 ON T0.CntctCode = T1.contctCode
AND T1.U_Fecha >= [%0] AND T1.U_Fecha <= [%1]
[%0] and [%1] are the parameters in SAP B1 and I want those parameters in crystal, there in the left join otherwise it won't work. U_Fecha are date parameters by the way.
Regards.
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.