Mid question in SSRS (1 Viewer)

ielamrani

Registered User.
Local time
Today, 04:57
Joined
May 6, 2008
Messages
51
Hi,
I am trying to retrieve a number from a field where it's between = and =
I have tried mid

=mid(Fields!PRE_LAB_VAL.Value,4,4)

but not working

PRE_LAB_VAL --------------------------Result

PT=45.7=02/07/2002-----------------45.7
RTS=51=02/07/2002------------------51
RT=26=02/07/2002--------------------26

Thank you
 

Rx_

Nothing In Moderation
Local time
Today, 02:57
Joined
Oct 22, 2009
Messages
2,803
Look for instr function - something like this
Code:
Public Function FindBetweenEqual(MyString As String) As String
Dim MySearchString As String
Dim MyResultString As String
Dim MyResultString2 As String
Dim FirstEqualPosition As Integer
Dim SecondEqualPosition As Integer
FirstEqualPosition = InStr(1, MyString, "=")
Debug.Print "position of equal sign is " & FirstEqualPosition
MyResultString = Right(MyString, (Len(MyString) - FirstEqualPosition))
Debug.Print MyResultString
SecondEqualPosition = InStr(1, MyResultString, "=")
MyResultString2 = Left(MyResultString, SecondEqualPosition - 1)
Debug.Print MyResultString2
FindBetweenEqual = MyResultString2
End Function

Somewhat the same on the SQL Server side
http://www.sqlservercentral.com/Forums/Topic1330327-2846-1.aspx
This topic uses two different delimiters instead of two "=" characters.

My guess would be to use this code to create a new field with just the values and use that in the SSRS field selection.
 
Last edited:

ielamrani

Registered User.
Local time
Today, 04:57
Joined
May 6, 2008
Messages
51
thank you for your quick response.

I tried but did not work. I am new in ssrs.
 

WayneRyan

AWF VIP
Local time
Today, 08:57
Joined
Nov 19, 2002
Messages
7,122
I think you want the Charindex and SubString functions.

Wayne
 

Users who are viewing this thread

Top Bottom