Rob, Thanks for pointing out how to use the formatted style.
EntityText8splitter is a "string processor" function, returns different values (srcEntity, fcstSrcEntity, etc, ...). Instead of using more and more Entity Text fields for the same purpose (Forecast seeding in this case), Splitters are created to process and return drivers of "Seeding" exercise in different use cases. This is our response to the facts that logics are getting more complicated as business requirements change, and we have limited Text field for each member.
Public Function entityText8Splitter(entityText8 As String) As (srcEntity As String, fcstSrcEntity As String, operSign As String, srcU6 As String)
Dim srcEntity, fcstSrcEntity, operSign, srcU6 As String
srcEntity = entityText8
fcstSrcEntity = ""
operSign = ""
srcU6 = ""
If Instr(entityText8,"FcstSource") > 0 Then 'Test FcstSource existance
fcstSrcEntity = Mid(entityText8, Instr(entityText8,"FcstSource")+10, 101)
If Instr(fcstSrcEntity,",") > 0 Then
operSign = Mid(fcstSrcEntity, Instr(fcstSrcEntity,",")+1, 1)
srcEntity = Left(srcEntity, (srcEntity.Length - fcstSrcEntity.Length -10 -1)) 'FcstSource and ","
fcstSrcEntity = Left(fcstSrcEntity,Instr(fcstSrcEntity,",")-1)
Else
srcEntity = Left(srcEntity, (srcEntity.Length - fcstSrcEntity.Length -10 -1))
End If
End If
If srcEntity.XFContainsIgnoreCase("U6#") Then 'Test U6# existance
srcU6 = Mid(srcEntity, Instr(srcEntity, "U6#"),101)
srcEntity = Left(srcEntity, Instr(srcEntity, "U6#")-2)
If Instr(srcU6, ",") > 0 Then 'Test , existance
operSign = Mid(srcU6, Instr(srcU6, ",")+1, 1)
srcU6 = Left(srcU6, Instr(srcU6, ",")-1)
End If
End If
Return (srcEntity, fcstSrcEntity, operSign, srcU6)
End Function