Solved

Formula fields value change from mfc application in crystal 9.0

Posted on 2004-04-22
6
422 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 101

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

626 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