Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Formula fields value change from mfc application in crystal 9.0

Posted on 2004-04-22
6
Medium Priority
?
427 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 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