Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Dynamic Params - Multiple values Post Reply Post New Topic
Author Message
kali
Newbie
Newbie


Joined: 05 May 2010
Online Status: Offline
Posts: 6
Quote kali Replybullet Topic: Dynamic Params - Multiple values
     Posted: 04 Aug 2010 at 5:36am
Hi
 
I have a fully functioning report which uses dynamic parameters for Account identifiers and date ranges passed into an SQL command that retrieves data from a table based upon these param values.
 
At the momentg, the Account identifier parameter is a single value - a request has come through to allow users to multi select account values such that the SQL command becomes .... Where account_id in ('xxx','yyy') - the user is not able to select 'yyy' as the dynamic param only allows one value to be selected and passed into the query.
 
I want the user to be able to pass in more than one value for the param '{?Portfolio}'
 
Here is the command as it stands now
 
 
SELECT A.A_EXTACCID as Ext_Port_ref,
  I.A_INSID,
  ISNULL(I.A_ISICDE,'N/A') as ISIN,
  ISNULL(I.A_SEDCDE,'N/A') as SEDOL,
  ISNULL(I.A_BBCDE,'N/A') as BBG,
  A.A_ACCID,
CASE E.A_TRDSDE
   WHEN 'B' THEN 'BUY'
   WHEN 'S' THEN 'SELL'
END AS TRDSDE,
  ISNULL(C.A_CTRPTYID,'N/A') as Broker,
  SUBSTRING(E.A_TRDDTE,0, 9) AS TRADEDATE,
  ISNULL (SUBSTRING(E.A_STTDTE,0, 9),'N/A') AS STTDTE,
  SUBSTRING(E.A_ADDDTETME,9, 4) AS ADDTME,
  E.A_QTY,
  E.A_STTCCYCDE,
  ISNULL(I.A_PRCFAC,1) as pr_fact,
  (E.A_PRC * I.A_PRCFAC) as  Dealt_price, 
  E.A_NETCSD, 
  E.A_CMSAMT,
CASE E.A_TRDSDE
 WHEN 'S' THEN (E.A_NETCSD / E.A_QTY)
 WHEN 'B' THEN (E.A_NETCSD / E.A_QTY)
END AS NETPRC,
  E.A_INSNAM,
  ISNULL(E.A_GIVUP, 'N') AS IS_CFD, 
  CASE ISNULL(E.A_GIVUP,'N')
 WHEN 'Y' THEN 'ML'
 WHEN 'N' THEN 'N/A'
END AS GIVEUP,
  ISNULL(I.A_RICCDE, 'N/A') as RIC,
  ISNULL(E.A_LCLFEE,0) AS LOCAL_FEE,
  ISNULL(E.A_LCLTAX,0) AS LOCAL_TAX,
  SUBSTRING(E.A_ADDDTETME,0, 9) AS INPUT_DATE
FROM T_ATH_EXE E
JOIN T_ATH_ACC A ON E.A_ACCID = A.A_ACCID
JOIN T_ATH_CTRPTY C ON C.A_CTRPTYID = E.A_CTRPTYID
JOIN T_ATH_INS I ON I.A_INSID = E.A_INSID
WHERE cast((substring(E.A_ADDDTETME, 5, 2) + '/' + substring(E.A_ADDDTETME, 7, 2) + '/' + left(E.A_ADDDTETME, 4))
as datetime) BETWEEN {?startDate} AND {?endDate}
AND E.A_SYCSTA = 3
AND E.A_EXETPE = 'M'
AND A.A_ACCID = '{?Portfolio}'
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Aug 2010 at 3:16am
what I did was create a function in SQL server that would parse a delimited string and return a table.  Then you can join the table in the FROM clause and filter that way, instead of using IN...which never seems to work as expected....
 
HTH
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum