Search Multiple Names Separated by "COMMA" or "AND" 

Search Multiple Names Separated by "COMMA" or "AND" 

  

Hello,

I want to know how can i search for multiple names separated by "comma" or "and". 

Please show me step by step how to do it.

Best Regard

Hind Ahmed 

Hi hind Ahmed,

Do you want type names separated by comma in text box and then search?

Please elaborate your use case.

Thanks and Regards,

Suraj Borade

You are going to need to parse the search string and use it to construct a WHERE clause to pass to an Advanced Quesry as a paramter. Set that parameter's "Expand Inline" property to the opposite of whatever the default setting is (I always forget which is which).


So, you'll do something like:


  1. Make the search string all lowercase
  2. Use the RegExReplace in Text extension to replace "\W+and\W+" (I think, just freehanding my regex here...) with commands, that should replace any instances of the word "and" with a comma.
  3. Use String_Split on the result to split on commas.
  4. Iterate over the result, to slowly build up a WHERE clause in the form of "WHERE Field LIKE '%Value%' AND..."
  5. Pass that WHERE clause into the Advanced Query.

J.Ja

I think justin suggetion(use String_Split on the result to split on commas and iterate over the result, to slowly build up a WHERE clause in the form of "WHERE Field LIKE '%Value%' OR)  will fullfil hind`s requirement.

Regards

SK


Suraj Borade wrote:

Hi hind Ahmed,

Do you want type names separated by comma in text box and then search?

Please elaborate your use case.

Thanks and Regards,

Suraj Borade

Hello Suraj

Yah i want to type the name separated by comma or the "AND" in text box and then search. 

either comma or the "AND" or both its fine.

Could you help me please and show me how to do it step by step?!

Best Regard 

Hind Ahmed 

Justin James wrote:

You are going to need to parse the search string and use it to construct a WHERE clause to pass to an Advanced Quesry as a paramter. Set that parameter's "Expand Inline" property to the opposite of whatever the default setting is (I always forget which is which).


So, you'll do something like:


  1. Make the search string all lowercase
  2. Use the RegExReplace in Text extension to replace "\W+and\W+" (I think, just freehanding my regex here...) with commands, that should replace any instances of the word "and" with a comma.
  3. Use String_Split on the result to split on commas.
  4. Iterate over the result, to slowly build up a WHERE clause in the form of "WHERE Field LIKE '%Value%' AND..."
  5. Pass that WHERE clause into the Advanced Query.

J.Ja

Hello Justin 

I think i am lost where do i have to start  to "Make the search string all lowercase" ?!

thanks for the help but how can i start building the search with comma or AND while i have the search function 

can you please explain in details so i can catch up

Best Regard

Hind Ahmed 

Hind -


This comes up enough that I put together some sample code:

http://www.outsystems.com/Forge/Component_Overview.aspx?ProjectId=1472


J.Ja