Hi all,
I'm trying to achieve multiple inputs search, each time i input the parameter, its show index 1 is out of range. How to solve the error and allows multiple input?
Search criteria:
1 input: Australia
2 inputs: Australia Test
OnSearch button
GetOffice Filters
Error:
Example: Australia
No record found.
Example: Australia <space>
For type Australia, it will returns two records and for Name + Address, bit changed the filter condition please update it.
SearchKeyword = "" or If(vTextList[1].Value = "", Office.Name like "%" + vTextList[0].Value + "%",If(vTextList[0].Value <> "" and vTextList[1].Value <> "", (Office.Name like "%" + vTextList[0].Value + "%") and (Office.Address like "%" +vTextList[1].Value+ "%"), (Office.Name like "%" + vTextList[0].Value + "%") or (Office.Address like "%" + vTextList[1].Value + "%")))
you can copy paste.
Let me know other conditions as well so I can modify it if needed.
Regards,
Shubham
Hi @Drexxor Ho, I am adding an updated OML, please look at it.The problem was when you type only one word the list will only have one value hence there is no index 1 and you get the error.What I did was removed the sting split and the list, I used built in replace function to replace spaces with comma, then changed the filter condition according to that.ThanksGitansh Anand
Hi Gitanash,
When i type A in the search bar, Australia did not come out. I needed to type the exact word search condition. How can i sort it out?
(SearchText = NullTextIdentifier() or Index("," + SearchText + ",", "," + Office.Name + ",") <> -1) or (SearchText = NullTextIdentifier() or Index("," + SearchText + ",", "," + Office.Name + ",") <> -1 and Index("," + SearchText + ",", "," + Office.Address + ",") <> -1)
I try to add this but didnt work.
First input: Australia listing came outSecond input: Australia Test (Didn't search)
Use the OML @Shubham Janbandhu gave, it has the logic you need.
i tried, It didn't return the results i expected
Hi @Drexxor Ho, try with this filter once, I am also add the updated OML
SearchKeyword = NullTextIdentifier() or ToLower(Office.Name) like "%" + ToLower(SearchKeyword) + "%" or ToLower(Office.Address) like "%" + ToLower(SearchKeyword) + "%" or Index("," + ToLower(Replace(SearchKeyword, " ", ",")) + ",", "," + ToLower(Replace(Office.Name, " ", ",")) + ",") <> -1 or Index("," + ToLower(Replace(SearchKeyword, " ", ",")) + ",", "," + ToLower(Replace(Office.Address, " ", ",")) + ",") <> -1ThanksGitansh Anand
Hi Gitansh Anand and Drexxor Ho,
I was trying to understand this below condition given by Drexxor,
As per my understanding vTextList[0].Value is for Office.Name and vTextList[1].Value is for Office.Address means user can search only two string. If that is the scenario, then I made changes to the filter condition as mentioned below.
By using this filter, the Index out of range error has been fixed. Only the thing is needed to append vTextList.Values with ""(empty string) on OnInitialize. Now filter is also working as expected. Also check OnSearch action.
Result:
Search Office.Name as "aus" and Office.Address as "tk"
I don't know if this is the exact requirement but tried to solve it.
@Drexxor Ho, let me know if it is correct.
Updated oml.
Hi Shubham,
When i type Australia, it will returns two records.
When i want to search the exact Name + Address, the output should be the following:
yeah, sorry my mistake I corrected it, and it is working now.
Updated condition.
Link: Demo. Now, Name and Address working as expected.
Thanks,
Hi @Drexxor Ho, Did you try the updated filter condition I provided? I am adding the condition again, and you can check the OML from my last reply.SearchKeyword = NullTextIdentifier() or ToLower(Office.Name) like "%" + ToLower(SearchKeyword) + "%" or ToLower(Office.Address) like "%" + ToLower(SearchKeyword) + "%" or Index("," + ToLower(Replace(SearchKeyword, " ", ",")) + ",", "," + ToLower(Replace(Office.Name, " ", ",")) + ",") <> -1 or Index("," + ToLower(Replace(SearchKeyword, " ", ",")) + ",", "," + ToLower(Replace(Office.Address, " ", ",")) + ",") <> -1 ThanksGitansh Anand
THanks this works but it seems a little complicated. Is there a better way to deal with this kind of search inputs?
glad I help you out for now. It was also complicated and new scenario for me as well. Let me check if I can minimize it.
Thanks!
Hi Drexxor Ho,
Try this condition.
Hope this helps.