Page 1 of 1

Is there a way to use the split function in a report

Posted: Thu May 28, 2009 2:22 pm
by mdavidson
I have a field in a bussiness object in my Data Dictionary that is a comma delimited list of numbers.
Is there a way in the report code to do something like
tempStr = Split({FanGroup.Sound_PowerLevelsOutlet}, ",")
so I can display text as tempStr(0),tempStr(1),tempStr(2) etc.

Is there a way to use the split function in a report

Posted: Thu May 28, 2009 3:14 pm
by mdavidson
I'm sorry, but I figured out a way.
I added a function to the code of the report

Public Class Report
Inherits Stimulsoft.Report.StiReport

Public Function ExtractValue(aString As String,aPlace As Integer) As String
Dim retStr As String = String.Empty
Dim tempStr() As String
tempStr = aString.Split(",")
If tempStr.Length > aPlace Then
retStr = tempStr(aPlace)
End If
Return retStr
End Function

... And then from a text component I can add the expression

{ExtractValue(FanGroups.SoundPowerLevelsInlet,0)}

Is there a way to use the split function in a report

Posted: Wed Feb 17, 2010 1:21 pm
by chad
Here is how I did it

Code: Select all

    	// custom functions
		public string SplitString(string rsString, string rsDelimiter, int riItem) {
			if (rsString.Contains(rsDelimiter)) {
				return rsString.Split(rsDelimiter.ToCharArray())[riItem];			
			} else {
				return rsString;
			}
		}