Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Condition Formula change with C#.NET Post Reply Post New Topic
Author Message
Silvan
Newbie
Newbie


Joined: 09 Jul 2012
Online Status: Offline
Posts: 1
Quote Silvan Replybullet Topic: Condition Formula change with C#.NET
    Posted: 09 Jul 2012 at 1:05am
Hi
I have made a Methode "ReplaceFormelFelder" (below) which can search and replace a string in the FormulaFields. Now I would do the same for the condition formulas. How can I do that?
There is a picture from a condition formula (supress formula):
 

        public static int ReplaceFormelFelder(ReportDocument rpt, string oldValue, string newValue)
        {
            int iCounter = 0, index = 0;
            bool replace = false;
            string text = string.Empty;
 
            foreach (FormulaFieldDefinition item in rpt.DataDefinition.FormulaFields)
            {
                text = item.Text;
                if (text != null)
                {
                    index = text.IndexOf(oldValue);
 
                    while (index != -1)
                    {
                        iCounter++;
                        replace = true;
 
                        if (text.Length > index + 1)
                            index = text.IndexOf(oldValue,index + 1);
                        else
                            index = -1;
                    }
 
                    if (replace)
                    {
                        item.Text = text.Replace(oldValue,newValue);
                        replace = false;
                    }
                }
            }
 
            return iCounter;
        }



Edited by Silvan - 09 Jul 2012 at 11:58pm
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Jul 2012 at 7:25am
For the report selection formula, look at the ReportDocument.DataDefinition.RecordSelectionFormula property.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.