cancel
Showing results for 
Search instead for 
Did you mean: 

List of values selection criteria not displayed in Crystal .Net Viewer

derek_harrison
Explorer
0 Kudos

I have a report (written by someone else) that when run displays a list of Branches on the screen for the user to pick from.

This works within Crystal Reports XI Release 2 but does not work in the .Net Viewer (CRRuntime_32bit_13_0_12.msi).

Some years ago we had a screen in our software using the old ActiveX viewer (CrystalXIViewer5.5.msi) and the reports works fine in that.

The new screen that uses the .Net Viewer, it is very simple and was written in C# in Microsoft Visual Studio 2008. This is not the actual screen used within our application but a very simplified version just to demonstrate the problem.

The .Net Viewer displays a box where the user can enter a Branch Number, but in Crystal Reports and in the old ActiveX viewer it displayed a list of branches and the user could highlight the desired Branch and click the arrow button to choose it for the report.

Here is how the report looks when it runs in the Crystal Reports or in the old ActiveX viewer

Here is how the same report looks when it runs in the new .Net Viewer, the "Available Values" list is not there.

Any help appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Derek,

Depends on how you created the report. Those old list of values shows up in a different collection now.

Use this collection and not the old one:

May require a RPT update.

Not enough info to be specific so try this first.

Don

derek_harrison
Explorer
0 Kudos

Thanks,
Sorry, but I didn't write the report and I'm not very knowledgeable about adding selection criteria to Crystal Reports and I don't know how to do that (I'm just the guy that gets the blame for everything). Is that something I can do in Crystal Reports XI R2, do I need a newer version, or do you mean changing code in the screen?

I found the Edit Parameter (below) for this report:


You can see that this is dynamic, not static - does that make a difference to your answer?

0 Kudos

Hi Derek,

I am logged on so the values can get populated, are you logging on first? And does this report happen to have Saved Data?

What happens if you hit the Refresh button and select Prompt for new?

Don

derek_harrison
Explorer
0 Kudos

Hi,
The report doesn't have saved data - that option is un-ticked in the report.

I'm using the ApplyLogOnInfo to set the ServerName, UserID and Password on all the tables in the report. I then call the Refresh() method on the report document object. I think that is working as the report will run and I get the report results. All that is done before the report displays so, yes, I think it is logged on.

When I hit the refresh button the parameter screen re-displays and shows the criteria and I can change it but it doesn't give me the choice, as Crystal Reports does, of new values or existing values.

former_member183750
Active Contributor
0 Kudos

Hi Derek

I've bee following this thread and it occurs to me that we had a very similar issue pre SP 9, documented in this KBA.

Now there is a difference; the issue was that the parameter worked in 32 bit, but not 64 bit apps.

So, it would be good to confirm that on your dev computer you are using SP 12 and a 32 bit compile - not Any CPU for now please.

Now, we also had an issue in CR 2008 documented in this KBA. The interesting part in that KBA is the line of code:

crReportDocument.DataSourceConnections(0).SetConnection("Sever Name", "Database Name", "Use ID", "Password")

I am wondering if you could add that to your project and see if it helps(?).

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

derek_harrison
Explorer
0 Kudos

Hi Ludek,

Here is the project property page:

It is set to "x86" not "x64".

So I tried the solution from the second KBase article. I added the following code (but using the real names) - I've had to translate from VB to C#.

CrystalDecisions.Shared.DataSourceConnections     vdataSourceConnections;

CrystalDecisions.Shared.IConnectionInfo                 vpIConnectionInfo;

//DataSourceConnections

vdataSourceConnections = voReportDocument.DataSourceConnections;

vpIConnectionInfo = vdataSourceConnections[0];

vpIConnectionInfo.SetConnection("server", "dbase", "username", "password");

If I use an incorrect password the report will stop and ask for connection details, if I use the correct password it does not. This is good as it proves the code is running and doing something.

Unfortunately it doesn't solve the problem - the report runs and gets results but still no list of values displayed on the selection criteria screen.

For a moment I thought you might have found it, but unless I screwed up adding the code I don't think this is it. 😞

former_member183750
Active Contributor
0 Kudos

Hi Derek

Both Don and I took the holidays off up to Jan 5. E.g.; the reason for the slow replies.

I think it may be a good idea for us to have a look at the report. Would you be able to attach it here? (Run the report in the CR designer, enable saved data and save. Rename the rpt to txt. Then in the reply to this thread, hit the "Use advanced editor" link ant attach. I'm actually not going to be back until Jan 7 so I can look at it then. Other alternative is to create a phone case here:

Crystal Single Case Technical Support - SAP Business Objects US Online Store | SAP Online Store

If this turns out to be a bug, the case will be refunded.

Umm, thinking a bit more on this. One other thing to do may be interesting; export the report to rpt file format - from the .NET app. You will have to code the export to rpt file format as the viewer does not have that option by default.

See KBA: 1498827 - How to set the list of available export types in the .NET CrystalReportViewer control

And / or sample app csharp_win_export.zip here:

Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki

- Ludek

derek_harrison
Explorer
0 Kudos

Hi Ludek,
Other projects have kept me from this for a few weeks.

Rpt file attached as a zip (named as a .txt)

0 Kudos

Hi Derek,

Thanks for the report. I can test using the same type of parameters as you are using. Note that because they are dynamic before the report runs it should be connecting to the DB so it can query for the values.

So you may want to change your work flow for reports with saved data, make sure you are logged on and change the Parameter Prompt setting in the Viewer.

Days over now so I'll test tomorrow.

Thanks

Don

derek_harrison
Explorer
0 Kudos

Hi Don,

Never used saved data - everything is always dynamic.

I have tried very hard to get it all connected to the database and logged on before the report is run - I think this is working but who knows!

0 Kudos

Hi Derek,

I created a report using Xtreme MDB that I imported into my DQL Server Database and then set up the Dynamic parameter the same way your param is setup and ran SQL Profiler.

I set the log on info and connected to SQL server and then hit the Preview button. Because of the LOV requirement I get the prompt for parameter values with the list populated. Looking at SQL Profiler you see the query sent to get the LOV:

As you can see the query to get the values is ran and I see this in my app:

I select the top 4 values:

And now Profiler runs the report with those values in the WHERE clause:

So something in possibly your log on info is either failing or possibly the Client is not passing the request to the Server to get the values.

Try using this logon API:

CrystalDecisions.Shared.ConnectionInfo crConnectioninfo = new CrystalDecisions.Shared.ConnectionInfo();

set the variable for the log on and then call:

foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)

{

    mainSecureDB = rpt.Database.Tables[tableIndex].LogOnInfo.ConnectionInfo.IntegratedSecurity;

    string mainTableName = crTable.Name.ToString();

    tableIndex++;

    crConnectioninfo.ServerName = btrDataFile.Text.ToString();

    if (!mainSecureDB)

    {

        crConnectioninfo.ServerName = btrDataFile.Text.ToString();

        crConnectioninfo.UserID = btrFileLocation.Text.ToString();

        crConnectioninfo.Password = btrPassword.Text.ToString();

        crConnectioninfo.DatabaseName = btrSearchPath.Text.ToString();

        //crConnectioninfo.DatabaseName = "xtreme";

    }

    else

    {

        crConnectioninfo.IntegratedSecurity = true;

        crConnectioninfo.UserID = btrFileLocation.Text.ToString();

        crConnectioninfo.Password = btrPassword.Text.ToString();

        crConnectioninfo.DatabaseName = btrSearchPath.Text.ToString();

    }

    crTableLogOnInfo = crTable.LogOnInfo;

    crTableLogOnInfo.ConnectionInfo = crConnectioninfo;

               

    try

    {

        crTable.ApplyLogOnInfo(crTableLogOnInfo);

    }

    catch (Exception ex)

    {

        btnSQLStatement.Text = "ApplyLogOnInfo failed: " + ex.ToString();

    }

...

Then throw this in just to verify you are connected:

if (crTable.TestConnectivity())

    ConWorks = true;

else

    ConWorks = false;

If you can send me the SQL to create your tables I can test your report also.

Don

Answers (0)