cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PeKa6
Regular Visitor

No result from LookUp (Or error message)

Hello!

I am quite new to PowerApps, so bear with me.

I am working on a simple app to manually input values to a database. In order to determine if the value is plausible I want to display the value of the previous day and the difference in edit mode. I am using the standard template for making a database app.

I am using a LookUp formula that looks like this (In edit mode): 

LookUp('[dbo].[RonderingKVV1]';RondDate = PrevRondDate;Råvatten)

RonderingKVV1 is my SQL table.
RondDate is a date data type.

PrevRondDate is a date datatype that is computed as (dateadd(day,(-1),[RondDate])) in the SQL table. I was going with RondDate - 1 to begin with but changed it during troubleshooting.

Råvatten is a float datatype.

 

If I try changing the forumla to look at the primary key 

LookUp('[dbo].[RonderingKVV1]';IDKey = 1;Råvatten)

it returns the value so I'm guessing I've done something weird with the dates.

I don't get any error messages or warning, just a blank label.

I've been pulling my hair over this for the better part of the day, so any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

HI @PeKa6 ,

Could you please share a bit more about the PrevRondDate in your SQL table? Is it also a Date type column in your SQL Table?

 

I assume that the PrevRondDate that you mentioned is also a Date type column in your SQL Table, is it true?

Based on the formula that you provided, I think you have some misunderstanding on the Filter functions (e.g. LookUp, Filter, Search) in PowerApps.

 

When using Filter functions (e.g. LookUp function) in PowerApps app, the second argument of it is required to provide a condition formula. In default. the left side of the condition formula should be a column name, the right side of the condition formula should be a specific value rather than a column name:

LookUp('Data Source', ColumnName = "A specific value")

E.G.

LookUp('[dbo].[RonderingKVV1]'; RondDate = DateValue("04/05/2019"); Råvatten)  

 

As an fixed solution, I have made a test on my side, please take a try to modify your formula as below:

LookUp(
'[dbo].[RonderingKVV1]';
RondDate = DateAdd(ThisItem.RondDate, -1, Days); /* <-- The DateAdd() function is used to calculate the previous day value of the RondDate value of current item */
Råvatten
)

Or

LookUp(
'[dbo].[RonderingKVV1]';
RondDate = DateAdd(ThisItem.RondDate, -1, Days) /* <-- The DateAdd() function is used to calculate the previous day value of the RondDate value of current item */
).Råvatten

More details about the DateAdd function, please check the following article:

DateAdd function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xida-msft
Community Support
Community Support

HI @PeKa6 ,

Could you please share a bit more about the PrevRondDate in your SQL table? Is it also a Date type column in your SQL Table?

 

I assume that the PrevRondDate that you mentioned is also a Date type column in your SQL Table, is it true?

Based on the formula that you provided, I think you have some misunderstanding on the Filter functions (e.g. LookUp, Filter, Search) in PowerApps.

 

When using Filter functions (e.g. LookUp function) in PowerApps app, the second argument of it is required to provide a condition formula. In default. the left side of the condition formula should be a column name, the right side of the condition formula should be a specific value rather than a column name:

LookUp('Data Source', ColumnName = "A specific value")

E.G.

LookUp('[dbo].[RonderingKVV1]'; RondDate = DateValue("04/05/2019"); Råvatten)  

 

As an fixed solution, I have made a test on my side, please take a try to modify your formula as below:

LookUp(
'[dbo].[RonderingKVV1]';
RondDate = DateAdd(ThisItem.RondDate, -1, Days); /* <-- The DateAdd() function is used to calculate the previous day value of the RondDate value of current item */
Råvatten
)

Or

LookUp(
'[dbo].[RonderingKVV1]';
RondDate = DateAdd(ThisItem.RondDate, -1, Days) /* <-- The DateAdd() function is used to calculate the previous day value of the RondDate value of current item */
).Råvatten

More details about the DateAdd function, please check the following article:

DateAdd function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Your problem could be that the data is stored as a datetime, so you only get an exact match if the time portion of the two dates is identical. To resolve this, I'd use the DateDiff function to get the difference in days - e.g. DateDiff(PrevRondDate, RondDate, Days) = 1

Anonymous
Not applicable

Thanks for posting in the community @PeKa6 - can you review the above replies and update the thread if they were helpful? 

 

Thank you,

 

@Anonymous 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,447)