Hi everyone, in an sql table, I have a DATAAPP (char8) date field "20210915" and in my app I have a datapicker. I need to filter in the table all records whose date is greater than my datepicker. I tried but when I enter (DATAAPP> Label38.text) in the Filter, I have an error, while (DATAAPP = Label38.text) does not give an error. Could you give me some advice? Thanks in advance
Solved! Go to Solution.
The reason for this problem is that it's not possible to carry out numeric greater than/less than comparisons when the source data types are strings.
The way I would resolve this would be to create a SQL Server view that converts your char8 field to the data type date. This is how the view would look.
CREATE VIEW yourView
AS
SELECT
CAST( YourCharDateField AS date) AS YourDateField,
OtherField1,
OtherField2
FROM
YourTable
You can then connect to this view from your app and filter the records using the greater than or less than operators operators.
Filter(YourView, YourDateField >= DatePicker1.SelectedDate)
The benefit of this solution is that the filter operation will be delegable in Power Apps.
The reason for this problem is that it's not possible to carry out numeric greater than/less than comparisons when the source data types are strings.
The way I would resolve this would be to create a SQL Server view that converts your char8 field to the data type date. This is how the view would look.
CREATE VIEW yourView
AS
SELECT
CAST( YourCharDateField AS date) AS YourDateField,
OtherField1,
OtherField2
FROM
YourTable
You can then connect to this view from your app and filter the records using the greater than or less than operators operators.
Filter(YourView, YourDateField >= DatePicker1.SelectedDate)
The benefit of this solution is that the filter operation will be delegable in Power Apps.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
182 | |
47 | |
46 | |
34 | |
33 |
User | Count |
---|---|
260 | |
87 | |
79 | |
68 | |
67 |