Solved

Formula fields value change from mfc application in crystal 9.0

Posted on 2004-04-22
6
408 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
recommend split: frodoman & mlmcc

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

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed, with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

17 Experts available now in Live!

Get 1:1 Help Now