cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ICEMAN65
Helper I
Helper I

SET GLOBAL VARIABLE FROM LATEST VALUE IN SHAREPOINT LIST

I have a sharepoint list that is automatically populated with a daily exchange rate (Columns: CurrencyCode, FxDate,FxRate) and am trying to set a global variable (FxR) with the OnStart property of my app.

I am using the following, but it doesn't seem to be populating the variable.

 

What am I doing wrong?

 

Set(FxR,First(
FirstN(Sort(FxRates,FxRate, Descending),
1
)
)
)

2 ACCEPTED SOLUTIONS

Accepted Solutions
HenriDesmet59
Super User
Super User

How do you use your variable ?

When you put the item in the variable, to get the value of a column you need to write : 

LastItem.Column

 

View solution in original post

timl
Super User
Super User

@ICEMAN65 

I note that your formula sorts by FxRate in descending sequence. Therefore, I suspect that sorting by FxDate will produce the correct result.

Set(FxR,
    First(
      FirstN(Sort(FxRates,FxDate, Descending),
             1
      )
   )
)

 

View solution in original post

4 REPLIES 4
HenriDesmet59
Super User
Super User

Hello @ICEMAN65 ,

 

If you want to bind the latest value to a global variable from a SharePoint List, you can write the following : 

Set(LastItem,First(Sort('test liste';ID;Descending)))

The Sort by ID get you the last item in the first place. 

 

Tell me if It's ok for you 🙂 

 

Henri

ICEMAN65
Helper I
Helper I

That still isn't working I don't get a value in my variable. It doesn't seem to be picking up the value i need from the relevant column in my sharepoint list.

HenriDesmet59
Super User
Super User

How do you use your variable ?

When you put the item in the variable, to get the value of a column you need to write : 

LastItem.Column

 

timl
Super User
Super User

@ICEMAN65 

I note that your formula sorts by FxRate in descending sequence. Therefore, I suspect that sorting by FxDate will produce the correct result.

Set(FxR,
    First(
      FirstN(Sort(FxRates,FxDate, Descending),
             1
      )
   )
)

 

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 (6,116)