Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2007, 02:01 AM
Authorized User
 
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in formula in Crystal Report

Hi

I am getting an error while trying to pass a string value to a formula field in crystal report. I am using VB.Net

Error message is

"The remaining items doen't appear to be part of the formula"

this is the line of code
        rptDocument.DataDefinition.FormulaFields.Item(1).T ext = "Receipt"

but when I use data fields from a table it works fine.But I cannot assign a string constant.
rptDocument.DataDefinition.FormulaFields("crT").Te xt = "{ReceiptMast.RecNo}" , works fine.

I have tried the below lines of code also, but no result.

rptDocument.DataDefinition.FormulaFields.Item("For mulaName").Text = "Receipt"

rptDocument.DataDefinition.FormulaFields("FormulaN ame").Text = "Receipt"

pls help
 
Old October 31st, 2007, 03:13 PM
Authorized User
 
Join Date: Nov 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bharatsaboo Send a message via Yahoo to bharatsaboo
Default

you forgot the semi-colon at the end of the statment
your statement should read as follows

        rptDocument.DataDefinition.FormulaFields.Item(1).T ext = "Receipt";
 
Old November 1st, 2007, 01:12 AM
Authorized User
 
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Bharat

I am using VB.Net
I tried all the codes below

 rptDocument.DataDefinition.FormulaFields.Item(1).T ext = "Receipt"

rptDocument.DataDefinition.FormulaFields.Item("For mulaName").Text = "Receipt"

rptDocument.DataDefinition.FormulaFields("FormulaN ame").Text = "Receipt"

but the same error message is coming



 
Old November 6th, 2007, 01:06 PM
Authorized User
 
Join Date: Nov 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bharatsaboo Send a message via Yahoo to bharatsaboo
Default

hi prakash

sorry to reply to you late

where exactly are you using the particular code segment that you sent me
please elaorate so that we can fix the error

regards
 
Old November 7th, 2007, 01:59 AM
Authorized User
 
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Bharat

This is my code

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click

        Dim strReportPath As String
        Dim strReportName = "rptReceiptDisplay.rpt"
        Dim crTableLogoninfo As New TableLogOnInfo
        Dim crTableLogoninfos As New TableLogOnInfos
        Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent

        If CRRecViewer.Visible = False Then CRRecViewer.Visible = True
        strReportPath = Application.StartupPath & "\" & strReportName & ".rpt"

        crTableLogoninfo.ConnectionInfo = crConnectionInfo
        crTableLogoninfos.Add(crTableLogoninfo)
        CRRecViewer.LogOnInfo = crTableLogoninfos

        CRRecViewer.SelectionFormula = "{ReceiptMast.RecNo}= " & txtReceiptNo.Text
        rptDocument.Load(strReportPath)
        rptDocument.DataDefinition.FormulaFields.Item("crT ").Text = "Receipt"
        CRRecViewer.ReportSource = rptDocument
        CRRecViewer.Refresh()
        CRRecViewer.Show()

    End Sub

Regards

 
Old November 13th, 2007, 01:16 PM
Authorized User
 
Join Date: Nov 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bharatsaboo Send a message via Yahoo to bharatsaboo
Default

hi prakash

please check your declaration of the variable strReportName

You have already included the extention ".rpt" into the variable

why are you adding another extention ".rpt" when putting some value into strReportPath


strReportPath = Application.StartupPath & "\" & strReportName & ".rpt" -------- ??????????????

Regards

Bharat
 
Old November 15th, 2007, 07:27 AM
Authorized User
 
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Bharath

That is not the problem. Sorry I just wrongly pasted the code at that time. The problem is there in the same line. And one more thing can u please tell me how can I edit a Report title in a report at runtime.


rptDocument.DataDefinition.FormulaFields("FormulaN ame").Text = "Receipt"
Thanks and Regards

Prakas

 
Old November 20th, 2007, 08:55 PM
Authorized User
 
Join Date: Nov 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bharatsaboo Send a message via Yahoo to bharatsaboo
Default

hi prakash

you cannot change the name of the formula field at runtime using code
for that you will have to create an unbound field and then set that field

regards

bharat
 
Old November 29th, 2007, 10:20 AM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You keep missing the problem.

rptDocument.DataDefinition.FormulaFields("FormulaN ame").Text = "Receipt"

This ("FormulaName") field does not show up in the report because it is string data.

This is the only problem.

The word "Receipt" is being passed from the VB code to the report but it does not show up on the report. When I user numeric data that does show up on the report.

Do you have a solution?

 
Old November 29th, 2007, 10:50 AM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default


This is answer !!!!!!!!!!!!!

                                       RepDoc.DataDefinition.FormulaFields("SchoolID").Te xt = "'" & SchoolID & "'"

THIS WORKS !!!!!!!!!!!!!!







Similar Threads
Thread Thread Starter Forum Replies Last Post
crystal report formula suresh.cgmohan VB How-To 0 November 2nd, 2006 06:10 AM
crystal report error sureshbabu Crystal Reports 3 September 11th, 2006 01:42 AM
Error While printing report (Crystal report) vikaspaweb Pro VB 6 0 March 8th, 2004 09:53 AM
needing help for formula editor in crystal report anilkumar Crystal Reports 1 January 7th, 2004 04:13 PM
Pass String webpage to Crystal Report (formula) winnie1778 Crystal Reports 0 October 18th, 2003 01:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.