cancel
Showing results for 
Search instead for 
Did you mean: 

.NET UFL in multiply ReportDocuments/Viewers

Former Member
0 Kudos

Hi together,


We are using Crystal Reports for VS2013 (CRforVS_13_0_13) in WinForms.

We have also an own UFL written in C# and .NET 4.

Everything works fine, but I have some scenario which I cannot solve yet.

In our application it is possible to preview multiply Crystal Previews in the same time.

The UFL is still in memory. But our UFL stores a lot of information for further functions, like tables, custom variables and so on.

What I need is, that each Preview/ReportDocument uses his own Instance of this UFL.

Before SP 10 we use Crystal Preview as a separate Process, so there was no problem. But because of speed issues we have decided to include all Crystal Logic in our main Application. Now Crystal is much faster but this a blocker for us.

I hope you understand what I mean and hope for a solution


Thank you very much in advance


Best regards


Steven Vissers

Accepted Solutions (1)

Accepted Solutions (1)

daniel_paulsen
Active Contributor
0 Kudos

try importing the UFL into the application and initialize and destroy it within the application to see if that works

Former Member
0 Kudos

How can I do that?

However, If you have 2 previews open in same time you can not destroy the UFL, because the same UFL is used by the other Viewer.

The Idea about threading is a good Idea, but the Report hanging in MTA mode (this mode not share the UFL....)

But even without a UFL, a blank report hangs in MTA mode. Please see my attachment above.

I believe that threading is the right way.

0 Kudos

Hi Steven,

Unfortunately CR runtime only supports STA mode, always has done this since V5 when I started.

Add this to your app.config file also:

<startup useLegacyV2RuntimeActivationPolicy="true">

  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>

What database driver are your reports using?

I'm curious, if you open 2 reports in CR Designer that use unique info for each do you get the correct data when Previewed?

Don

Former Member
0 Kudos

Hi Don,

yes and no....if I open the first report all data is fine. After I open the second report, this data is fine also, but if I go back the first report and refreh or change the page, data is not correct anymore, because the data is comming form report 2 (UFL Data).

I use standard SQL Provider. The UFL uses SQL Proder too.

Former Member
0 Kudos

Hi Don,

I think I will rewrite the UFL.

My idea is to give every Report a ID number. This ID I will generate from code and pass it to a Report field with a custom UFL Function to set the current ID in my UFL. This Field is in in the first pageheader (this page I will add also by code).

The UFL detect with ID is current and provide the data with is belong to the ID

I tried it and I am alomost finsih. I think this solution is better.

Thank you anyway for your help. Please close this topic.

Steven

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

Hi Steven

Only way I can think of each report using it's own version of the UFL would be to thread the app. See the following:

KBA 1403341 - How to export reports in multiple threads using the Crystal Reports .NET RAS SDK

KBA 1792976 - Report Processing has full control and there is no access to do other things while the rep...

KBA 1613561 - How to call a Windows form containing the CrystalReportViewer control on a separate thread





- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Former Member
0 Kudos

Hi Ludek,

thank you for your answer. I thought something like this.

But I had no luck. Every approch fails.

If I use STA, UFL will be shared

If I use MTA, UFL seems to be not shared, but the Report Viewer just freezing with a ContextSwitchDeadlock Message....

Any Idea's?

Thnak you again

Steven

former_member183750
Active Contributor
0 Kudos

If you do a test with a report that does not use the UFL, is the behavior the same?

Make sure both the viewer and the report engine are on the same thread. You can not have the viewer as a parent thread and the report engine on a child thread.

- Ludek

Former Member
0 Kudos

- Yes I have used a blank report.

- All is in one thread (from creation of Report Document until ShowDialog from Viewer)

I have created a small project (Rename from txt to zip please)
Maybe I am too confused.....

Former Member
0 Kudos

Any Idea's?