Hi,I'm new to OutSystems and this is the first time I'm posting here so please excuse me if I don't explain my issues very well.
I am making a form to log dispatched items and wanted to add an ability for the users to be able to see a few of the last entries and also to search through older entries.Ideally, I want them to be able to search based on the attribute they can select from the dropdown menu I've added.I've managed to get the dropdown to show the names of all the relevant attributes and I know how to set up the search bar but I've been trying for hours now to link these two together so that a user can select the attribute they want to search through and search for the keyword they input into the search box.
tl:dr How to set up search so that the keyword is searched within the selected Attribute, e.g. pick "Accessories" and search for "www"
Hi Marcin!I'm assuming the list that populates that dropdown has an Id and Label.You can a boolean attribute (IsSearchable) in that list which is only true if it is indeed selected in the dropdown.Then an expression in the aggregate for each attribute:If(DropdownListAccessories.IsSearchable,DispatchTrackingDatabase.List.Current.DispatchTracking.Accessories like "%" + SearchKeyword + "%",True) orIf(DropdownListStaffName .IsSearchable,DispatchTrackingDatabase.List.Current.DispatchTracking.StaffName like "%" + SearchKeyword + "%",True) or (...)
Hope this helps!
Hi Luis,As Mithun mentioned, the way the dropdown was set up originally wouldn't work as it was only writing the names of the attributes, which I then tried appending within the function.
You both have pointed out that the dropdown needs to grab the Id and Label instead, which I will try to remember for the future.I'm sure your function would achieve the same result but I've already tested Mithuns implementation and it works so I will stick with that.
Thank you for your help.
Considering your scenario. I have made changes. I have added a static entity to get column names in the drop-down. Now based on a selection from the drop-down and the search key word, the result is getting fetched. Please find attached oml file.If you don't want to add static entity, then create a one server action and pass the selected drop-down value's id, based on that gets the name and return it. Use the same name in the filter instead of --> SearchBy variable
hi, use condition in the aggregate. something like this:
ContainerCollectionLocation.Location like '%' + Location_Input + '%'
Hi ibox,
Thank you for your quick reply.
I've tried doing what you've suggested but it didn't work. The way that the dropdown is setup might be incorrect as I've got it to write into a LocalVariable called "SearchBy" and from what I understand it only writes the name of the attribute, e.g. "Courier", and not the full location reference, so what I tried doing is adding the "SearchBy" var to the location designation in different ways, like shown below, but I'm struggling to figure out how to do it
Below is an example of what happens when I use your method
Hi Marchin,
You need to add filter like this --> DispatchTracking.Accessories like "%" + SearchKeyword + "%"
The filter below you have added that is incorrect.
DispatchTrackingDatabase.List.Current.DispatchTracking.Accessories like "%" + SearchKeyword + "%"
Please find attached oml. It is working fine now.
Also, if you want to search irrespect of the any field like accessories, then you can add or condition in the filter.
eg: DispatchTracking.Accessories like "%" + SearchKeyword + "%" or DispatchTracking.StaffName like "%" + SearchKeyword + "%"
Hi Mithun,Thank you for your help, it solves part of the problem but I still can't figure out how to get the attribute that you search in to change dynamically, based on the input in the dropdown menu.EDIT: I've tried your method of searching through multiple attributes and if I don't find a way to search through a selected attribute I will use that method, thank you.
Hi Mithun,
That does exactly what I wanted. thank you.
I've tried doing this with nested if statements but I think I've used the wrong syntax. Also, I see that, even if set up the function correctly, It wouldn't work with how I have set up the dropdown (which I suspected before) so thank you for showing me the correct way to achieve this.
Hi Marcin,
I am glad that I could able to help you.
Happy learning
Hi Mithun,Do you know why the Courier input box pre-fills with "COUNTER" in this new version?I don't see where the default value might coming from.
Hi Marchin, Are you talking about pre-filled form. Please refer below screen shot
if yes, Because input box values is getting hold by the aggregate attribute e.g DispatchTrackingDatabase.List.Current.DispatchTracking.Courier. Hence we are getting pre-filled values.
I'm talking about the two fields shown in the screenshot.
When the form is refreshed, the "Courier" field contains "COUNTER" and the "Stock" field contains "0"
It's not a huge deal but ideally, I would like all the fields to be empty.Seems like something is setting these values after the "SaveOnClick" logic is completed as there is a "RefreshData" logic module that I'm using to reset the form after a successful submission.