I am trying to use the below code to filter my data based on several field, in which I am selected From date and To date from date picker which i inserted, but it is not working , neither it is producing error, therefore cannot understand reason
Note : I tried "DeliverFromDate_1.SelectedDate" instead of "DeliverFromDate_1.Value", but underlined red color, but when it is value, then it is not red.
Please advise correction of writing these types of code
Filter(
colAllList,
(
Len(HoldModel.Value) = 0 ||
HoldModel.Value in Model
) &&
(
Len(HoldSerial.Value) = 0 ||
HoldSerial.Value in Serial
) &&
(
Len(HoldCustomer.Value) = 0 ||
HoldCustomer.Value in CustomerName
) &&
(
Len(DeliverFromDate_1.Value) = 0 ||
DeliverFromDate_1.Value >= DelDate
) &&
( Len(DeliverDateTo_1.Value) = 0 ||
DeliverDateTo_1.Value < DelDate+1
)
)
My screen image is as below for your fast reference
My screen image of my table in teams of that field is as below for quick reference
Dear,
Going further for test number of records, just to focus on collecting and supplying date for the filter, I removed all and kept the code in this way, No error BUT not proper result, while in the images you can see it is fetching the start date correct and end date correct from the data base, then if i keep both the field blank it should bring the result 4556, while it bring only 818 records.
Cannot understand the mistake, taking the target to fix code first and then further.
Please guide as this fix and method has to be applied in several screen
Filter( colAllList,
(DelDate >= If(IsBlank(DeliverFromDate_1), First(SortByColumns(colAllList, "cr333_deldate", SortOrder.Ascending)).DelDate, DeliverFromDate_1.Value)) &&
(DelDate <= If(IsBlank(DeliverDateTo_1), First(SortByColumns(colAllList, "cr333_deldate", SortOrder.Descending)).DelDate, DeliverDateTo_1.Value))
)
In my case as the database exist, No need now,
we can use
if blank Then lookup the Minimum for the start date else the date picker date
If blank then lookup the maximum for the end date else the date picker date
Its just an idea which I use in MS access programming
I was just reading in some search in google to add If with the date criteria with some blank result
I mean IF isblank(datepicker field) then NOW() Else the datepicker date
Can some thing will work, please guide
sorry, copy and paste complete code.
No Error No records
copied and pasted your complete advised code
Same no error no result
@MIA27 Please use IsBlank for other controls too instead of Len function
Filter(
colAllList,
(
IsBlank(HoldModel) ||
HoldModel.Value in Model
) &&
(
IsBlank(HoldSerial) ||
HoldSerial.Value in Serial
) &&
(
IsBlank(HoldCustomer)||
HoldCustomer.Value in CustomerName
) &&
(
IsBlank(DeliverFromDate_1)||
DeliverFromDate_1.Value >= DelDate
) &&
( IsBlank(DeliverDateTo_1) ||
DeliverDateTo_1.Value< DelDate+1
)
)
-----------------------------------------------------------------------------------------------------------------------------
I hope this helps.
Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍
Thanks,
ANB
I tried the advised code, as shown below
Result - No Error No result (does not filter any records in the gallery, even if both the field is blank
Filter(
colAllList,
(
Len(HoldModel.Value) = 0 ||
HoldModel.Value in Model
) &&
(
Len(HoldSerial.Value) = 0 ||
HoldSerial.Value in Serial
) &&
(
Len(HoldCustomer.Value) = 0 ||
HoldCustomer.Value in CustomerName
) &&
(
IsBlank(DeliverFromDate_1)||
DeliverFromDate_1.Value >= DelDate
) &&
( IsBlank(DeliverDateTo_1) ||
DeliverDateTo_1.Value< DelDate+1
)
)
@MIA27 Please try this:
(
IsBlank(DeliverFromDate_1)||
DeliverFromDate_1.Value >= DelDate
) &&
( IsBlank(DeliverDateTo_1) ||
DeliverDateTo_1.Value< DelDate+1
)
-----------------------------------------------------------------------------------------------------------------------------
I hope this helps.
Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍
Thanks,
ANB
sorry, I should have mentioned,
I am developing this app in Teams powerapp.
On the screen I selected the insert - Date picker
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional