user1033744
user1033744

Reputation: 73

Visual Studio Report Project

In my report dataset I have a column call "Period" that contains s string like "From August 2012 until December 2013". In my VS Report project, I need a a tablix that has a column based on the first date in short form (e.g. Aug 12) from the above. I understand that in SQL Server, I can achieve this by using the following statement

select  substring(Period,6,3) + ' ' + substring(Period,(CHARINDEX(' until',Period)-2),2)

But in the VS Report expression, the above statement is not recognized and therefore cannot be used.

I have tried searching for an equivalent in Report expression format but have not come across a similar case.

Would really appreciate if you can advise me how to do this in Report expression language.

Upvotes: 0

Views: 99

Answers (1)

Chris Latta
Chris Latta

Reputation: 20560

Report expressions use VBA syntax not Sql, so Substring is Mid and CharIndex is IndexOf:

=Mid(Fields!Period.Value, 6, 3) & " " & Mid(Fields!Period.Value, (IndexOf(" until", Fields!Period.Value)-2, 2)

Upvotes: 1

Related Questions