samuelbrody1249
samuelbrody1249

Reputation: 4767

MDX convert number to string / concat mixed type

How would I do the following cast operation?

CAST(Season) + PlayerSlug

PlayerSlug is of type System.String and Season is of type System.Int32. I want the result to be something like:

"2014-TomJones"

How would I do this? Doing a straight concat returns a type of Int32 instead of string:

PlayerSlug + Season

Upvotes: 1

Views: 1996

Answers (2)

Martin Currin
Martin Currin

Reputation: 1

Try CStr() and CInt() to convert to string and int. E.g. CStr(Season) + PlayerSlug

Upvotes: 0

Alex Peshik
Alex Peshik

Reputation: 1515

If you need this on MDX you can try to use Member_Name and check if it's WChar (by default it's WChar even for integer keys).

Member Name type

Test query:

with member [Year_Country]
as [Date].[Year].CurrentMember.Member_Name
+" - "+[Location].[Country].CurrentMember.Member_Name
select
 [Year_Country] on 0
,[Location].[Country].Members*[Date].[Year].Members on 1
from [My_Cube]

Result is:

Member Name concat result

Upvotes: 1

Related Questions