AnsweredAssumed Answered

ExplodeText Custom Function

Question asked by Hudi on Apr 7, 2014
Latest reply on Apr 8, 2014 by coherentkris

Hi,

 

I need a little help fixing (or understanding) a custom function meant to explode text. I'm using the result of this function as the foreign key in a portal filter. Alternatively, if someone has a working function to accomplish this that would be ideal .

 

It's two functions that I found on BrianDunning.com. The second one calls the first.

 

1. ExplodedKey ( Text )

If (

Length ( Text ) > 1 ;

ExplodedKey ( Left ( Text ; Length ( Text ) - 1 ) ) & "¶" & Text ;

Text

)

 

2. ExplodedString( StringFieldName)

Let(

[FieldName = Left ( StringFieldName & " "; Position ( StringFieldName ; " "; 1 ; 1 ) - 1 );

Counter = PatternCount ( StringFieldName ; " " )];

 

 

Case(

Counter = 0 ; "" ;

Counter > 30 ; "ERROR: too many fields" ;

ExplodedKey ( FieldName ) & "¶" &

ExplodedKey (Substitute ( StringFieldName & " " ; FieldName & " " ; "" )

)

)

)

 

 

Here is the result I'm getting for "Son of Batman" and I can't figure out why.

 

S

So

Son

o

of

of

of B

of Ba

of Bat

of Batm

of Batma

of Batman

of Batman

 

"Son of Batman" looks like this when it should explode every word indivually, so user could type in "Batman" and the portal would include this record.

 

THANK YOU

Outcomes