cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,494)