Hi All
I have a gallery in which i have already got a Date Picker that i am able to Filter by using the Formula in the Items in the gallery.
If(IsBlank(DatePicker1.SelectedDate),'Harbour House Key History',Filter('Harbour House Key History', 'Date Out' = DatePicker1.SelectedDate))
I now want to add a Text input search function that will be able to filter on another column. also with the function that if the text input is blank i can see all results.
Data Source: 'Harbour House Keys'
Column: 'Name in'
Text Input: TextInput1
Kind Regards
Justin
Solved! Go to Solution.
For the code above,
If(
IsBlank(DatePicker1.SelectedDate),
testList,
Search(
Filter(
AddColumns(
testList,
"NameInFinal",
nameIn.Email,
"NameOutFinal",
nameOut.Email
),
dateCol = DatePicker1.SelectedDate
),
TextInput1.Text,
"NameInFinal",
"NameOutFinal"
)
)
I was able to get it working (tested using nameIn.Email and nameIn.DisplayName). Please check if displayname works instead? I noticed in my dataset, some names didn't have emails. Also, above had typo (assuming it's a cut/paste issue - missing 'i' of 'if')
For this small filter, that should work. If you are looking to filter with more parameters, I would recommend going back to the following format. I think all that was missing earlier, was the .DisplayName to access the properties of the person column. I was able to get both of below working
///
with delegation issue (if)
///
Filter(
testList,
If(
IsBlank(DatePicker1),
true,
dateCol = DatePicker1.SelectedDate
),
If(
IsBlank(TextInput1),
true,
Or(
TextInput1.Text in nameIn.DisplayName,
TextInput1.Text in nameOut.DisplayName
)
)
)
///////
using collection
///////
Filter(
collectTest,
If(
IsBlank(DatePicker1),
true,
dateCol = DatePicker1.SelectedDate
),
If(
IsBlank(TextInput1),
true,
Or(
TextInput1.Text in nameIn.DisplayName,
TextInput1.Text in nameOut.DisplayName
)
)
)
Try setting up your filter this way; should allow you to add more options as needed
Filter(
'Harbour House Key History',
If(IsBlank(DatePicker1.SelectedDate), true, 'Date Out'=DatePicker1.SelectedDate),
If(IsBlank(TextInput1), true, 'Name in'=TextInput1.Text)
)
Hi Thank you for your reply
I Tried this Formula and unfortunately this formula doesn't bring back any results for me in my gallery.
I also got back a delegation warning on the date picker line.
Kind regards
Justin
Can you check if the column is 'Name in' vs 'Name In'?
If you are trying to avoid delegation issues, I would recommend collecting the 'Harbour House Key History' during OnVisible
Clear(collectHistory);
Collect(collectHistory, 'Harbour House Key History');
And then filter collectHistory, instead of the source
Hi @JEVANSAP ,
If 'Name in' is of type choice, then you can use -
Filter('Harbour House Keys', (IsBlank(DatePicker1.SelectedDate) || StartDate > DatePicker1.SelectedDate) And StartsWith('Name in'.Value, TextInput1.Text))
I have added a collection as suggested 'CollectHistory' and done some testing on different variations of the formulas from the both of your reply's unfortunately these are still coming up with errors.
I think i might have to do it differently, instead of filtering on both, maybe i could do it where i can either Search Via date or Via Name.
f(IsBlank(DatePicker1.SelectedDate),collectHistory,Filter('Harbour House Key History', 'Date Out' = DatePicker1.SelectedDate) Or Search(collectHistory,TextInput3.Text,"NameIn","NameOut"))
This is the formula i came up with but whatever i change i still get the message: The Function Search 'Search' Has some invalid Arguments.
Hi @JEVANSAP ,
Try using below formula -
If(IsBlank(DatePicker1.SelectedDate), collectHistory, Search(Filter('Harbour House Key History', 'Date Out' = DatePicker1.SelectedDate),TextInput3.Text,"NameIn","NameOut"))
I tried this formula and it still dosnt work. If i just have the formula for the date picker it works, but as soon as i want to add the text search in i get red X everywhere. I think i might have to just have the date picker as my only filter function.
Kind Regards
Justin
Justin,
We should be able to figure this out; taking a step back
- What are the column types from your source for date, name?
- If you just put the text input as your filter, no date - what's the error message?
With the column types, I can try to build it out fully later
Try removing the collection and directly use the list name as data source -
If(IsBlank(DatePicker1.SelectedDate), 'Harbour House Key History', Search(Filter('Harbour House Key History', 'Date Out' = DatePicker1.SelectedDate),TextInput3.Text,"NameIn","NameOut"))
User | Count |
---|---|
124 | |
87 | |
87 | |
75 | |
69 |
User | Count |
---|---|
215 | |
181 | |
140 | |
97 | |
83 |