Macro Split and Get Values

Charles Matvchuk asked on March 4, 2015 22:19

I need to use a macro to split a document field value and get position 1 and position 2. The delimiter is ";". I can do this easily in c#, but I need to use a macro to get the values in a web part property. I have tried different syntax using Split and Substring to no avail. Rather than write a custom macro I would like to use the Split functionality that already exists in Macro expressions.

String is: Blue;Ford

I need a macro to get Blue. Car is the field in the document(page).

Correct Answer

Jim Spillane answered on March 4, 2015 23:46

Give this a try

{%
StringIs = "Blue;Ford";
return StringIs.Split(";")[0];
|(identity)GlobalAdministrator%}
1 votesVote for this answer Unmark Correct answer

Recent Answers


Charles Matvchuk answered on March 5, 2015 00:09

Wow, I thought I tried something similar. Works well thanks.

0 votesVote for this answer Mark as a Correct answer

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