Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts ,
I have a scenario where I am getting multiple substring inside a string , I need to reduce the multiple occurrence to 1st occurance .
eg :
Input:
'this test is a test string test '
Output:
'this test is a string'
I am using substringcount function but don't know how to move forward .
Regards,
Shantanu
And the qvw attached
Why you want to do this ?
Like what is the objective behind this ?
Can you provide more values which you have. I am expecting real data. So that, we will figure out. The reason i am asking this? Suppose, Sometimes we do have different size of values.
Hi All ,
I am concatenating 4-5 field values to form this string , 'test' coming multiple times does not make any sense . So need to reduce the final string to the first occurrence of the string 'test'.
Regards,
Shantanu
We can do different different ways. In fact, We will help you by using your key words as i recommend in the before Reply.
1) Replace(SubField(GetFieldSelections(Output),1),',','')
[Script]:
LOAD Welcome, SubField(Welcome,' ') as Output Inline [
Welcome
'this test is a test string test '
];
Output:
Hi anil ,
Thanks for the reply , can you please break it down and explain the thought process behind your solution .
Regards,
Shantanu
Where you are concatenating, can you concatenate distinctly? See this example for New:
Data:
Load * ,Rowno() as Row Inline [Text
'this test is a test string test'
'yet another test string test'
];
Tmp:
Load *,AutoNumber(Word,Row) as Id;
Load Row,SubField(Text,' ') as Word resident Data;
New:
Load Concat(DISTINCT Word,' ',Id) as NewText Resident Tmp Group by Row;
And the qvw attached