butmah

hi all ...
I was trying to change the database location at the runtime by using this code

Dim TPTReport As New TPT
Dim reportV As New ReportsViewer

TPTReport.Load()
Dim conn As New ConnectionInfo
Dim cmp = "c:\"

conn.ServerName = "it-abutmah"
conn.DatabaseName = cmp
conn.UserID = ""
conn.Password = ""

Dim tables As CrystalDecisions.CrystalReports.Engine.Tables
tables = TPTReport.Database.Tables
Dim table As CrystalDecisions.CrystalReports.Engine.Table
Dim tablelogininfos As TableLogOnInfos
Dim tablelogininfo As TableLogOnInfo


For Each table In tables
tablelogininfo = table.LogOnInfo
tablelogininfo.ConnectionInfo = conn
table.ApplyLogOnInfo(tablelogininfo)
table.Location = cmp & table.Location & ".dbf"
Next

reportV.source = TPTReport

the application was running fine, so the report, but after I used this, I start get the following error when I try to view the report

Error in File c:\DOCUME~1\abutmah\locals~1\Temp\temp-b99f422004dc.rpt
Error in formula <Record_Selection>
'{testpack.ret-trans}={ TRANSMITTAL NO.}'
this field name is not known


Please help ...
thanX anyway



Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

Manish Joisar

This means whatever fields you have used in formula it does not get at runtime when you have specified datasource

So just check with your datasource fields at runtime

Might this helps you to solve






Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

butmah

yes that is the problem, but what should i change in this code to solve it !!
thanX for interesting ....





Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

melody45

If you are changing the database location, make sure that the datasource for your report in the new database is EXACTLY the same as what was in your existing database. Check your field names, any paramaters or criteria, field types etc to make sure that the information is the same. If you are basing this report directly off a table, check to make sure that the tables in both databases are identical as far as the number of fields, the types,etc. Hope this helps





Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

butmah

Smile yes its exactly the same ... copy & past Smile ... and as I said in the first post, it was running fine but when I used that code to change the database location at the run time (dynamically), it started gave me that error ... I tried to debug it and watch the values of "TPTReport.Database.Tables" _after executing that code_it gave me zero number of feilds in this database, but it gave me the right location and name of the database.
thanX again





Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

Fiserv

Am having the same problem You you post if you have found solution to this.




Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

Fiserv

I just moved from .Net 1.1 to .Net 2.0.

My reports do not work as they used to work.

This is the piece of code the used to work....

rpt.Load(reportSource + @"\AuditLog\" + reportConfig.ReportName);

//rpt.SetDataSource("fsp_AuditLogReport_Get;1");

addReportParameter(rpt, "@EntryDtFrom", reportConfig.fromDate.ToString("G"));

addReportParameter(rpt, "@EntryDtTo", reportConfig.toDate.ToString("G"));

if (reportConfig.UserID!=null && reportConfig.UserID!="")

addReportParameter(rpt, "@UserId", reportConfig.UserID);

addReportParameter(rpt, "@Application", (reportConfig.AppName==null || reportConfig.AppName=="") "%" : reportConfig.AppName);

if (reportConfig.EnvironmentName!=null && reportConfig.EnvironmentName!="")

addReportParameter(rpt, "@EnvironmentName", reportConfig.EnvironmentName);

if (reportConfig.SPName!=null && reportConfig.SPName!="")

addReportParameter(rpt, "@SnapInName", reportConfig.SPName);

addReportParameter(rpt, "@MessageName", (reportConfig.MessageName==null) "%" : reportConfig.MessageName);

#region set up database connection to Communicator database

ParseDBConnForKey(dbConComm, out serverName, out database, out userid, out password);

logonInfo = new TableLogOnInfo();

logonInfo.ConnectionInfo.ServerName = serverName;

logonInfo.ConnectionInfo.DatabaseName = database;

logonInfo.ConnectionInfo.UserID = userid;

logonInfo.ConnectionInfo.Password = password;

for (int n = 0; n < rpt.Database.Tables.Count; n++)

{

rpt.Database.TablesNo.ApplyLogOnInfo(logonInfo);

rpt.Database.TablesNo.Location = database + ".dbo."

+ rpt.Database.TablesNo.Location.Substring(rpt.Database.TablesNo.Location.LastIndexOf(".") + 1);

}

#endregion

//rpt.Refresh();

//rpt.VerifyDatabase();

// Export the report

rpt.ExportToDisk(ExportFormatType.PortableDocFormat, fullPath);

*****************

private void addReportParameter(ReportDocument rpt, string param, string val)

{

if (val != null && val != "")

{

ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

crParameterDiscreteValue.Value = val;

ParameterValues CrParaVals = rpt.DataDefinition.ParameterFields[param].CurrentValues;

CrParaVals.Add(crParameterDiscreteValue);

rpt.DataDefinition.ParameterFields[param].ApplyCurrentValues(CrParaVals);

}

}

*****************

now i get a ...

Exception Type Name = FormulaException
Exception Number =
Exception Message = This field name is not known.
Error in File C:\DOCUME~1\kondursx\LOCALS~1\Temp\auditlog {D872CC24-4C12-4543-B75A-EEFDC3FECD38}.rpt:
Error in formula <DateToConverted>.
'DateAdd ("h", DateDiff ("h", {fsp_serverLocalTime;1.SqlLocalTime}, CurrentDateTime), { @EntryDtTo})'
This field name is not known.
Exception Trace = at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)
at Fiserv.CBS.Communicator.Tasks.ReportManagerTask.ReportGenerator.generateReport() in C:\Communicator\Base\7.2\Service Providers\Source Code\ReportManagerTask\ReportGenerator.cs:line 226
at Fiserv.CBS.Communicator.Tasks.ReportManagerTask.ReportManagerTask.OnRun(Guid msgGuid) in C:\Communicator\Base\7.2\Service Providers\Source Code\ReportManagerTask\ReportManagerTask.cs:line 126

The report uses 2 stored preedures. Am new to crystal so bear with me here.

Some the commented stuff in the code is what i have tried so far with not much luck. When i did the refreesh I saw that the Prameter values just dissappeared.

Thankx in advance for any help I can get.





Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

Manish Joisar

It seems like report is not getting @EntryDtTo parameter

Check at design time, is there any problem with same formula

If not check at runtime what datasource report is pointing to & check parameters are same as what it is at design time

Hope it helps






Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

Fiserv

I have checked at design time and there is no problem with the formula. It says "no errors found".

Also I checked at run time and the Parameters are all there. But like I said earlier, one thing I noticed was if I did a refreh on the reportDoc they all dissappear at run time. So some thing is going on there. And how do I check which data source does it point at run time. I dont see a getDataSource.

Thank You for responding.





Re: Crystal Reports for Visual Studio crystal reports: Error in formula <Record_Selection> ...... this field name is not known

benji_dv

Hi,
(sorry, I know that my english is very poor... but...)
I've the same problem on export to file (exportToDisk function of the reportDocument) my report by a C# code.
I've note that when I use the report in Crystal XI format, the problem is not present... but with a report in a Crystal X format, it does !
My customer does'nt Crystal XI, so if you have the solution...
I'm you customer !
Thanks you for responding,
Benjamin