cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Set Variable on startup

I have SharePoint list form which I would like to set a variable on existing forms and I am having some issues with it. On the SharePoint integration startup, I have setup the formula as follows

 

 

Set(varRiskRating,SharePointIntegration.Selected.'Risk Rating');Refresh('IT Supplier Risk Management');ViewForm(SharePointForm1)

 

 

 

To test this I have label on the form which shows the variable varRiskRating. The issue is that I have reload the form twice to get the variable to update. I have also created another label that just shows 

 

 

SharePointIntegration.Selected.'Risk Rating'

 

 

 

And this shows the actual value for any list item. 

History of what the form shows when I click on each item.

 

Item TitleRisk Rating Label (varRiskRating)Label (SharePointIntegration.Selected.'Risk Rating')
A140140140
B4014040
A14040140

 

Any ideas on how to get consistent values to the variable label?

8 REPLIES 8
Highlighted
Community Champion
Community Champion

Re: Set Variable on startup

Hi @Dhiran ,

Maybe refresh before you set the Variable

Refresh('IT Supplier Risk Management');
Set(varRiskRating,SharePointIntegration.Selected.'Risk Rating');
ViewForm(SharePointForm1)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted
Helper II
Helper II

Re: Set Variable on startup

Hi @WarrenBelz , 

 

Thanks for the reply. I have tried that and unfortunately the same issue still exists. I have to click twice on the list item to get the right number to show in the variable. I also have the same formula on EditForm and if I click on Edit once I view the form, then the variable does update. 

 

It just seems to be related to the ViewForm action.

Highlighted
Community Champion
Community Champion

Re: Set Variable on startup

@Dhiran ,

You have not said how you are updating the field - obviously you are editing a form with an updated rating and then going to a View form and displaying it in (I assume) a label as you are using a Variable. Have you thought of simply updating the Variable when you change the Value? For instance if you were doing this from a Choice DropDown/ComboBox called ddRiskRating, you would simply put on the OnChange of the control

Set(
   varRiskRating,
   ddRiskRating.Selected.Value
)

This should be a lot easier and reliable than having to refresh and re-query your data set.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Helper II
Helper II

Re: Set Variable on startup

Hi @WarrenBelz ,

 

to give more context to the usage. I currently have a simple SharePoint list with 2 fields, Title and Risk Rating(number). The aim of the form is to build the risk rating of an item based on questions (to be added later) which will have content controls that will have certain risk scores for different options. I would like to add all the question scores to provide a total risk score (varRiskRating). 

 

Once a new item has been submitted, I would like the users to have the ability to adjust to the total based on changing the controls but when I view an existing form, the formulas mentioned above do not provide me with the current Risk Rating which is where i am struggling. As I said the edit form does work but I cant get it work on the view form action.     

 

I hope that helps and appreciate your time in helping me. 

Highlighted
Community Champion
Community Champion

Re: Set Variable on startup

Hi @Dhiran ,

Thanks for the description - what you are saying is that a New form once submitted does not update? Are you going back to SharePoint and re-opening or are you retrieving the data some other way?

Highlighted
Helper II
Helper II

Re: Set Variable on startup

If I submit the a new form with the risk rating at 50 for example then for list has this value

 

If I then view the form by clicking on the list item the formula of setting the variable of the current Risk rating does not work. I have to click on the form twice to get it to update the variable. 

Highlighted
Community Champion
Community Champion

Re: Set Variable on startup

Thanks @Dhiran ,

To clarify what you are talking about by "list" you are referring to the SharePoint list display for the item after you have closed the Power Apps edit form?

Highlighted
Community Champion
Community Champion

Re: Set Variable on startup

Hi @Dhiran ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,710)