cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KUNGFUPANDA559
Level: Powered On

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
Luke_Timmins
Level 8

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
Dual Super User
Dual Super User

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.
Luke_Timmins
Level 8

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

KUNGFUPANDA559
Level: Powered On

Re: Retrieve Value from first record of table

This was exactliy what I was looking for @Luke_Timmins 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,686)