Solved

Formula fields value change from mfc application in crystal 9.0

Posted on 2004-04-22
6
415 Views
Last Modified: 2008-02-01
i am using crystal 9.0 in my mfc application. i want to chagne value of one formula field (String) from my application. i am passing recordselectionformula which is running very well. but could not able to pass formula field value. can anybody help me out .

code is

m_pApplication.CreateInstance("CrystalRuntime.Application.9");
_bstr_t FileName("Test.rpt"));
m_pReport = m_pApplication->OpenReport(FileName);

_bstr_t RecordSelectionFormula(m_strRecSelString);
m_pReport->PutRecordSelectionFormula(RecordSelectionFormula);

this above code is working fine .. now for passing formua ..

formula name is String - @Caption

CString strCap = "This is report new caption";
pReport->FormulaFields->Item[1]->put_Text(_bstr_t(strCap.GetBuffer(strCap.GetLength())));

when i run this is get runtime error ..
'Remaining text doesn't appear to be part of formula'

amit
0
Comment
Question by:amlooks
6 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 10887811
I believe the problem is that in order for this formula to produce the result you want, you have to pass the quotation marks into the formula as well.  I'm not sure of the syntax you need but for vb it would be changing this:

CString strCap = "This is report new caption";

To something like this:

CString strCap = ""This is report new caption"";


Another option is to create a parameter and pass the string value to the parameter instead of passing it to a formula.  If all you're using is static text here than a formula is really overkill.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10888560
Actually since CR accepts both " " and ' ' for strings use

CString strCap = "'This is report new caption'";

If you want to use " then you need 3 of them.  The first one is used for the string in VB, the second and third produce 1 inside the string.

CString strCap = """This is report new caption""";

mlmcc
0
 

Author Comment

by:amlooks
ID: 10915836
i got my answer ... it was not problem of crystal but with VC++ ..
thanks frodoman .. i have used parameter field instead of formula field ..

please delete this question ..

0
 
LVL 42

Expert Comment

by:frodoman
ID: 11855098
recommend split: frodoman & mlmcc

We both gave him the solution that solved the vc++ issue.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11871830
PAQed, with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now