How to split the node alais path in a transformation

lawrence whittemore asked on April 24, 2015 14:51

Trying to do this with no luck

<%# Eval("NodeAliasPath").ToString().Split("/")[1] %>

i'm in version 8

Correct Answer

Jim Spillane answered on April 24, 2015 17:08

char uses single quotes...

<%# Eval("NodeAliasPath").ToString().Split('/')[1] %>

4 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on April 24, 2015 14:55 (last edited on April 24, 2015 14:55)

I use that in a macro without issue, never tried in a transformation. Any errors in your event log? Maybe try:

<%# EvalText("NodeAliasPath").... %>

Here's my macro syntax:

{% "/" + CurrentDocument.NodeAliasPath.Split("/")[1] + "/Mobile.aspx" @%}
0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on April 24, 2015 15:00

This is the error. I could have sworn I had done this before in previous version.

Message: [TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=3ee37a0b-9fc9-41fa-bbcc-119ec482e8d2/CMS.BookingEvent/CalendarEvent.ascx(2): error CS1502: The best overloaded method match for 'string.Split(params char[])' has some invalid arguments

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on April 24, 2015 17:13

That was it. Thanks!

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 24, 2015 18:38

Ahh yes the char vs. string. Geez technicalities!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.