Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using only the first two words of a field value

Hi everyone, I have a spreadsheet with the heading Description. This is a list of details of regular repeating information i.e bank payment is this, someone paid you that, bank payment is something. So you can see that the first two words are always going to be quite similar every time.
Is it possible to have te script look for only the first two words and discard the rest of the field? I know you can do something with finding the first space but this has got me stuck.
Many thanks.
1 Solution

Accepted Solutions
Not applicable
Author

Hello Phil,

check this out: I assume you need the 'LeftText'-solution:

LOAD

    . . .

     Text,

    Left(Text, Index(Text,' ', 2))                AS LeftText

    Right(Text, Len(Text) - Index(Text,' ', 2)) AS RightText,

    TextBetween(Text,' ', ' ')                    AS BetwText,

.  . .

Regards,

Roland

View solution in original post

5 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   So you want to skip the fields from spreadsheet or the data from particular field.

Regards

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
nagaiank
Specialist III
Specialist III

You may use the following script to skip the repeating string, if that is what you want.

Data:

LOAD *, Replace(Description,'bank payment is ','') as Newdescription;

LOAD * Inline [

Tnx, Description

1, bank payment is $200

2, bank payment is $100

3, bank payment is $500

];

x.bmp

Not applicable
Author

Hello Phil,

check this out: I assume you need the 'LeftText'-solution:

LOAD

    . . .

     Text,

    Left(Text, Index(Text,' ', 2))                AS LeftText

    Right(Text, Len(Text) - Index(Text,' ', 2)) AS RightText,

    TextBetween(Text,' ', ' ')                    AS BetwText,

.  . .

Regards,

Roland

Not applicable
Author

Hi Roland, thank you for this, its excellent! I will certainly be making use of the other examples.

Not applicable
Author

Hi Phil,

glad to help.

Roland