Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
stabben23
Partner - Master
Partner - Master

Read between two words

Hi I try to read text between two words, I use today TextBetween and it works when I have the second word.

Sometimes I dont have the second word and then it fail to read that line.

In my example I read: textbetween(Statement,'FROM ', 'WHERE' ) and this will give me the datasource, but sometimes ther is no WHERE statment in my query, any Idea?

//Staffan

4 Replies
Not applicable

Can you please post sample data ?

stabben23
Partner - Master
Partner - Master
Author

No, but like this:

bla bla lot of text bla bla FROM datasource Where A=B, this works and will give me datasource

bla bla lot of text bla bla FROM datasource, won´t work, gives me nothing.

//Staffan

maxgro
MVP
MVP

something similar to

=if(index('$(vText)','where'),

TextBetween('$(vText)', 'from', 'where')          // where exists

, SubField  ('$(vText)', 'from', 2))                    // where doesn't

but what about group by, order by , etc......?

vText is a variable in InputBox

Regards

stabben23
Partner - Master
Partner - Master
Author

That works, I have try them all, but not in the same if statment, nice.

You have also a point about group/order by, that will be the next to solve.

//Staffan