Platform

Platform

A place for Apptio product users to learn, connect, share and grow together.

 View Only
  • 1.  Can the Split function have a formula for n?

    Posted Mon January 20, 2020 03:34 PM

    Can the Split function n be a function or reference to another column? If not, is there another way to achieve this?

    Example:  

    TextConcat="TextMth1"&";"&"TextMth2"&";"&"TextMth3"

    TextForThisMonth=Split(TextConcat,CurrentDate("M"),";")

    Thanks


    #Platform


  • 2.  Re: Can the Split function have a formula for n?

    Posted Tue January 21, 2020 10:18 AM

    To my knowledge, the Split() function requires a number there.  Even a column reference will cause an error.

     

    However, there is hope.  We have another function that can handle this situation called Eval() (Eval function).  Long story short on this function is it takes a string and evaluates it as if it were a function. 

     

    So, for your example, you can create a column that produces a string that would evaluate the Split() in the way Apptio is expecting, and then point the Eval() function at that column.

     

    Split Fxn = "=Split(TextConcat,"&CurrentDate("M")&","";"")"

    TextForThisMonth = Eval(SplitFxn)


    #Platform


  • 3.  Re: Can the Split function have a formula for n?

    Posted Wed January 22, 2020 02:53 PM

    Can you give an example of what you're trying to split up?


    #Platform


  • 4.  Re: Can the Split function have a formula for n?

    Posted Thu January 23, 2020 09:31 AM

    Thanks Gregory,  this is helpful and I'll remember it for next time.  The workaround I used isn't as elegant but worked, it uses Find and Mid:

    TextConcat="Jan:&"TextMth1"&";Feb:"&"TextMth2"&";Mar:"&"TextMth3"....

    Text for This Month Split Prep1 =Mid(TextConcat,Find(CurrentDate("MMM"),TextConcat),10000)
    Text for This Month Split Prep2 =Split(Text for This Month Split Prep1,1,";")

    TextForThisMonth=Split(Text for This Month Split Prep2,2,":")


    #Platform