cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KUNGFUPANDA559
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
Luke_Timmins
Resolver II
Resolver II

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

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
Resolver II
Resolver II

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

This was exactliy what I was looking for @Luke_Timmins 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (66,110)