Count number of fields in ~~ delimited string
Posted: Wed May 09, 2007 6:21 am
I want to count the number of fields in a ~~ delimited string.
For example if the string is "field 1~~field2~~field3' the result should be 3.
I thought I could do this using the Count function (and add 1) or the DCount function.
Though when the string is 'field1~~~~field3', I'd like the result to be 3 as well, but in this case Count(string,'~~')=3 and DCount(string,'~~')=4, because there is 3 ways it can find a ~~ in the string.
Is there a way I can get the right count of the ~~ delimiters in Datastage?
For example if the string is "field 1~~field2~~field3' the result should be 3.
I thought I could do this using the Count function (and add 1) or the DCount function.
Though when the string is 'field1~~~~field3', I'd like the result to be 3 as well, but in this case Count(string,'~~')=3 and DCount(string,'~~')=4, because there is 3 ways it can find a ~~ in the string.
Is there a way I can get the right count of the ~~ delimiters in Datastage?