cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RMC-Pro
Helper II
Helper II

Seting a Global Variable from a DataSource Record

Hello Community,

I am sure someone can give me a hint what I am doing wrong.

 

What is wrong with the formula

Set(vG_SelectedRecord, First(Filter('Activities Days Records','Entry Belongs To' = vG_User.id)))

?

I want to get the whole DataSource Record into the Global Variable, instead after execution Global Variable holds a record where all columns but "Entry Belongs To" are empty.

 

Can somene help, it is killing me?

Tnxs

br

@RMC-Pro

1 ACCEPTED SOLUTION

Accepted Solutions

For anyone that could take any value form it. 

 

I think I discovered what is/was the problem in my case.

 

I am using CDS Custom Entity and I used Sort on a Standard Field (i.e., 'Modified On'). Field is populated with a date of modification by system (most probably CDS). Strange thing is, at least in my opinion - and if I am right, it seems the field is not for use by me a as developer or App user. So, the returned record from the upper formula in question is/was empty.

 

Workaround. I created my own "User Data Modified On" field and set Sort in the upper formula in question to this field and now everything is ok - I get populated record as needed.

 

Can someone share a thought or two, am I right in assumption and if so, why is that the case, if not, what would be the right explanation?!

br

@RMC-Pro

View solution in original post

4 REPLIES 4
Rahber
Super User II
Super User II

vG_User.id is empty that is why the the record that is returned has empty value because it full fill that conditions

What happens when you manually enter the user.id in the formula? does it return correct data in variable?

Set(vG_SelectedRecord, First(Filter('Activities Days Records','Entry Belongs To' = '1')))

 

Secondly where in the app are you calling this formula?

 

 

Please click Accept as Solution if it resolved your problem or give it a Thumbs Up if it helped you in anyway this will allow other people to search correct solutions effectively.

Thanks,

Rahber

Hello @Rahber ,

 

I don't think that is the problem (thinking at loud), as if I change the formentioned  formula with

Set(vG_SelectedRecord, First(Filter('Activities Days Records','Entry Belongs To' = vG_User.id)).'Entry Name')

global variable gets the text value stored under "Entry Name" from the record I am looking for.

 

Any additional thoughts?!

 

tnxs

br

@RMC-Pro

 

 

Hello @Rahber,

I missed part of the answer.

 

I am calling formula right at the start, in App - OnStart ( i.e., I need user parameters for the app).

 

Tnxs

br

@RMC-Pro

For anyone that could take any value form it. 

 

I think I discovered what is/was the problem in my case.

 

I am using CDS Custom Entity and I used Sort on a Standard Field (i.e., 'Modified On'). Field is populated with a date of modification by system (most probably CDS). Strange thing is, at least in my opinion - and if I am right, it seems the field is not for use by me a as developer or App user. So, the returned record from the upper formula in question is/was empty.

 

Workaround. I created my own "User Data Modified On" field and set Sort in the upper formula in question to this field and now everything is ok - I get populated record as needed.

 

Can someone share a thought or two, am I right in assumption and if so, why is that the case, if not, what would be the right explanation?!

br

@RMC-Pro

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,505)