cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Retrieve Value from first record of table

Having trouble declaring variable from first row in datasource.  

 

Ideally, using something like the following should return the desired_value from the datasource.  

 

error suggests invalid arguments.

 

datasource: SQL

datatype: varchar(15)

 

 

set(firstValue,text(datasource.desired_value)) 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver II
Resolver II

Re: Retrieve Value from first record of table

I think you are looking for something like this

Set(VarNameHere, First(DataSourceNameHere).ColumnNameHere)

If you want the complete row just remove the .ColumnNameHere snippet. Obviously replace values with a variable name, datasource name and column name.

Initiate from an OnSelect action or OnVisible page action.

Thanks
Luke

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User II
Dual Super User II

Re: Retrieve Value from first record of table

There is an actual function available in PowerApps that will return the first record in a data source. You'll preferably want to filter the data source to a subset of records that you know will contain the first record.

First(datasource)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Resolver II
Resolver II

Re: Retrieve Value from first record of table

I think you are looking for something like this

Set(VarNameHere, First(DataSourceNameHere).ColumnNameHere)

If you want the complete row just remove the .ColumnNameHere snippet. Obviously replace values with a variable name, datasource name and column name.

Initiate from an OnSelect action or OnVisible page action.

Thanks
Luke

View solution in original post

Highlighted
Helper II
Helper II

Re: Retrieve Value from first record of table

This was exactliy what I was looking for @Luke_Timmins 

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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