cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jsunnb
Frequent Visitor

Faster to LookUp or put record in var

So I have a screen that has multiple labels that get populated with values from the same SQL table. I'm currently filling each labels text with LookUp(table-name, filterValue = fieldName).result (generalized).

 I’m wondering if it would be faster to just set that lookup as the var and use that over again. Set(varRecord, LookUp(table-name, filterValue = fieldName)) and then set the text as varRecord.Result (as well as all the other ones)

Basically, is that var holding that record in memory or is it doing it do the lookup over and over anyways?

 

 Thanks for the feedback!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Jsunnb ,

Yes - I use Record Variables all the time, so

Set(
   varRecord,
   LookUp(
      table-name, 
      filterValue = fieldName
   )
)

will capture the entire record, then 

varRecord.YourFieldName

will show each field in the record.

 

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.

Visit my blog Practical Power Apps

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Jsunnb ,

Yes - I use Record Variables all the time, so

Set(
   varRecord,
   LookUp(
      table-name, 
      filterValue = fieldName
   )
)

will capture the entire record, then 

varRecord.YourFieldName

will show each field in the record.

 

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.

Visit my blog Practical Power Apps

SudeepGhatakNZ
Resident Rockstar
Resident Rockstar

@Jsunnb ,

 

Performance-wise, it is always good if you reduce the queries to DB.

You can query SQL, set a collection on App Start, and use the Lookup/Filter functions to query against the collection instead of SQL.

 

If my suggestion helped you, please give it a Thumbs up and mark it as a Solution so that it can benefit others in the community.
Jsunnb
Frequent Visitor

@SudeepGhatakNZ I haven't tried out collections. My concern is most of what I'm doing is relying on the delegation feature putting the work on the SQL server, and I was concerned putting it into a collection will force me into the 500 lines restriction.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,318)