Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to get an ACTION to perform a few string functions.
I figured out replacing the AND/OR but am having trouble trying to add '*' at the start and end of each word.
For example, if vInPut = (apple AND orange) OR mango
I want output = (*apple*,*orange*) | *mango*
REPLACE helps with changing the AND to , and OR to |
But how do I get a '*' around each word.
(PS. I need this specific format to perform a search, hence the *)
I could have the user enter , but I have picky users who would call this an "inconvenience"
PPS. Keep in mind there could be multiple such AND and OR combinations, so cannot assume there will be a fixed format, meaning you cannot REPLACE (vinput, '(','(*') because the ( may not always exist.
TLDR: ACTION string function to convert 'apple' to '*apple*' , and every 'word' converts to '*word*'
Thank you !
May be like this?
=Concat(
If(Len(SubField(Replace(Replace(Replace(Replace('(apple AND orange) OR mango', 'AND', ','), 'OR', '|'), ')', ' )'), '(', '( '), ' ', ValueLoop(1, 10))) > 1,
Chr(39) & '*', '')
&
SubField(Replace(Replace(Replace(Replace('(apple AND orange) OR mango', 'AND', ','), 'OR', '|'), ')', ' )'), '(', '( '), ' ', ValueLoop(1, 10))
&
If(Len(SubField(Replace(Replace(Replace(Replace('(apple AND orange) OR mango', 'AND', ','), 'OR', '|'), ')', ' )'), '(', '( '), ' ', ValueLoop(1, 10))) > 1,
'*' & Chr(39), '')
, '', ValueLoop(1, 10))
May be like this?
=Concat(
If(Len(SubField(Replace(Replace(Replace(Replace('(apple AND orange) OR mango', 'AND', ','), 'OR', '|'), ')', ' )'), '(', '( '), ' ', ValueLoop(1, 10))) > 1,
Chr(39) & '*', '')
&
SubField(Replace(Replace(Replace(Replace('(apple AND orange) OR mango', 'AND', ','), 'OR', '|'), ')', ' )'), '(', '( '), ' ', ValueLoop(1, 10))
&
If(Len(SubField(Replace(Replace(Replace(Replace('(apple AND orange) OR mango', 'AND', ','), 'OR', '|'), ')', ' )'), '(', '( '), ' ', ValueLoop(1, 10))) > 1,
'*' & Chr(39), '')
, '', ValueLoop(1, 10))
Just adding the wildcard around the words won't be enough. I think you need to take the efforts to build a rather larger logic with multiple if-loops in which you:
It's hard work to develop a routine which fetched all possibilities … and if the users make logically mistakes with the AND's and OR's and the appropriate nesting with brackets the returned results won't be like they are expected. Therefore the more rules you could set the easier would be your task and the better would be the results.
Here a posting which provides nearly all information which are available to a compound search: Compound-Search-demystified.
- Marcus
Did Sunny or Marcus' post help with your use case? If so, do not forget to return to the thread and use the Accept as Solution button on the post(s) that helped, this gives the poster credit for the assistance and lets the other Community Members know it worked for you. If you still require further assistance, leave an update.
Regards,
Brett
Thank you @sunny_talwar ! This seemed to do the trick !
I know its hacky and ideally I should be creating a better solution like @marcus_sommer mentions, but given my time constraints, this hacky fix is perfect !