Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2794

Re: crystal reports problem when splitting parameter data

$
0
0

The problem is not the parameter itself.  The problem, from experience with a similar issue, is that you're building SQL on the fly and Crystal doesn't like that.

 

Here's what I would do instead:

 

1.  Make the parameter a multi-select parameter.

2.  Take these lines out of the SQL:

 

---functie voor splitte string in meerdere results
DECLARE @str varchar(max)
SET @str = {?JobId}--'473031,472353'

DECLARE @separator varchar(max)
SET @separator = ','

DECLARE @Splited TABLE(item varchar(max))

SET @str = REPLACE(@str, @separator, '''),(''')
SET @str = 'SELECT * FROM (VALUES(''' + @str + ''')) AS V(A)'

INSERT INTO @Splited
EXEC(@str)
---

 

3.  Use this instead:

 

---functie voor splitte string in meerdere results

DECLARE @Splited TABLE(item varchar(max))

SET @str = 'SELECT * FROM (VALUES(''' + @str + ''')) AS V(A)'

INSERT INTO @Splited'SELECT * FROM (VALUES({?JobId})) AS V(A)

---

 

NOTE:  You may have to remove the parentheses that I've made bold around {?JobId} because I think that Crystal may put them in for you.

 

Also, since you're using a command, please see my blog post for info about how to use them correctly:  Best Practices When Using Commands with Crystal Reports.

 

-Dell


Viewing all articles
Browse latest Browse all 2794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>