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
Is there a way to use the split function in a report
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)}
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
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;
}
}