Report compilation error - How to prevent CS file deletion ?

Stimulsoft Reports.WEB discussion
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Report compilation error - How to prevent CS file deleti

Post by Alex K. »

Hello,

Please try to change the directly sql query instead usisng an additional variable:
((StiSqlSource)report.Dictionary.DataSources["DataSourceName"]).SqlCommand = newSqlCommand;

Thank you.
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Re: Report compilation error - How to prevent CS file deleti

Post by kgb2013 »

Hello.

What I am trying to do does not allow this.
I want the user to design the report and query and the code to provide only the values that the user cannot insert from the Reports Viewer.
Isn't there a way to achieve what I am trying to do?
Perhaps, changing the old query (SQLCommand) by find-and-replace could do this (if I use a templating mechanism of my own), but I was hoping there was a better solution.
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Re: Report compilation error - How to prevent CS file deleti

Post by kgb2013 »

Hi again.

I have tried this (after using :varName: as a template):

Code: Select all

			if (gid != null)
			{
				var valuesList = string.Join(",", gid);
				foreach (var ds in report.Dictionary.DataSources)
				{
					var sqlSrc = ds as StiSqlSource;
					var sql = sqlSrc.SqlCommand;
					sqlSrc.SqlCommand = sql.Replace(":varName:", valuesList);
				}
			}
..and I have managed to pass the list by code.
However, I think it would be nice if you supported this operation by other means.

Thanks. :)
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Re: Report compilation error - How to prevent CS file deleti

Post by kgb2013 »

Do you have any idea why this MRT causes infinite and identical queries to be sent to the DB?
St5.PNG
St5.PNG (100.19 KiB) Viewed 4484 times
This seems to happen because I connect the data source on "BeforePrint", but I don't understand under which conditions it does happen and under which it doesn't... :(
Attachments
21.mrt
(28.78 KiB) Downloaded 280 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Report compilation error - How to prevent CS file deleti

Post by Alex K. »

Hello,

Can you please send us a test data for your report.

Thank you.
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Re: Report compilation error - How to prevent CS file deleti

Post by kgb2013 »

Hello.

I will see if I can give you some more data, but I can't actually share my whole DB.
I won't be easy for me to share much.
It would be nice if we could avoid creating a DB for you to use.

But perhaps this helps:

When changing this query:
St_0.png
St_0.png (94.16 KiB) Viewed 4429 times
...into this:
St_1.png
St_1.png (114.54 KiB) Viewed 4429 times
...the problem appears (infinite and identical queries are being sent to the DB).

The only change to the query is the circled area.
How can this affect your library?
Could the query fail and your library try to re-send the query? (however, I have tried the query in SQL Server and it seems to be working...)

Also, I have noticed this: the query that has the problem, only has problem when I use a parameter @Sender='%%'. If I use a non-empty string like @Sender='%abc%' there is no problem:

No problem here:
WHERE (dc.IdWorkflow=3 OR dc.IdWorkflow=4) AND (dc.Status=1 OR dc.Status=11) AND
doc.IssueDate>=@FromDate AND doc.IssueDate<=@ToDate AND
ptc.IdOrgGroup=@grpID AND doc.IdDocumentKind IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) AND
COALESCE(dc.Sender,@EmptyStr) LIKE @Sender
ORDER BY doc.IssueDate DESC
',@grpID=1,@FromDate='2009-12-01',@ToDate='2013-12-20',@usrID=1,@Sender='%gj%',@EmptyStr=' '
select @p1
Problem appears here:
WHERE (dc.IdWorkflow=3 OR dc.IdWorkflow=4) AND (dc.Status=1 OR dc.Status=11) AND
doc.IssueDate>=@FromDate AND doc.IssueDate<=@ToDate AND
ptc.IdOrgGroup=@grpID AND doc.IdDocumentKind IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) AND
COALESCE(dc.Sender,@EmptyStr) LIKE @Sender
ORDER BY doc.IssueDate DESC
',@grpID=1,@FromDate='2009-12-01',@ToDate='2013-12-20',@usrID=1,@Sender='%%',@EmptyStr=' '
select @p1
I don't know what is going on here.
For the momment I will try to fix it by changing the query, but it would be great if you could see how can this happen.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Report compilation error - How to prevent CS file deleti

Post by Alex K. »

Hello,

Please try to change the name of parameter "Sender".
http://forum.stimulsoft.com/viewtopic.php?f=13&t=37737

Thank you.
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Re: Report compilation error - How to prevent CS file deleti

Post by kgb2013 »

Hi.

Unfortunatelly, that doesn't help.
Now I am trying to reproduce it in a smaller query, but with no luck yet.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Report compilation error - How to prevent CS file deleti

Post by Alex K. »

Hello,

Can you please send a smaller query which reproduce the issue for analysis.

Thank you.
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Re: Report compilation error - How to prevent CS file deleti

Post by kgb2013 »

Hello again.

I have limitted the query as much as I could.
I send you some tables and an MRT file.
All you have to do is:

- Create the tables.
- Probably add some random data in the tables.
- Feed the report with all the required variables. Perhaps you could use my previously posted project do test this (I think that was it: http://speedy.sh/7cAat/TestStimulsoft.zip).

If I have missed sth, let me know.

Best Regards,
Kostas
Attachments
Bug.zip
(4.85 KiB) Downloaded 271 times
Post Reply