cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SandraAkujobi
Post Partisan
Post Partisan

How to remove a default value

I'm quite stuck on removing a default value from the contract drop-down box. I created this with using adding another list to my app and taking the data from the contract column cause of the issue I ran into with the lookup threshold now I've got it to work by creating the drop-down box but it keeps showing a default value especially when you start a new form.

 

Another issue is on my form once an employee has clocked in and out and they later want to view their entries on the view page how can I hide the clock in and out button till they click to edit.

9 REPLIES 9

Hi @SandraAkujobi 

 

When you open a form in New mode, this resets all the controls and make them point to the Default value in each control. If you want to conditional apply that behavior, then you can set the Default property of the contract dropdown to below expression:

If(ShowValueTrue, LookUp(...Your formula to set default value))

Now, to toggle this ShowValueTrue variable, you can set it to false when the form is reset like Form -> OnReset -> Set(ShowValueTrue,false)

To show the variable at some point, lets say on change of a text field, then you can set the OnChange property of the text control like Text -> OnChange -> Set(ShowValueTrue,true)

 

For #2: You can detect the form mode and show/hide the datacards.

Select the datacard and set the "Visible" property as:

If(Form1.Mode = FormMode.Edit, true ,false)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Regarding the 2nd question that worked out well, thank you.

The first issue still does not work. the formula you gave {If(ShowValueTrue, LookUp(...Your formula to set default value))} did not work, what I put in was If(ShowValueTrue, LookUp(RWT_Projects.'Contract.No')) and it just came out as an error. RWT_Projects is another SharePoint  list connection added to my app to extract the contract no from the list to add to the app. So I'm not quite sure whats gone wrong. 

@SandraAkujobi 

 

What is the error that you are getting? Is it related to ShowValueTrue? If yes, then you need to set the variable when you want to change the value. 

To toggle this ShowValueTrue variable, you can set it to false when the form is reset like Form -> OnReset -> Set(ShowValueTrue,false)

To show the variable at some point, lets say on change of a text field, then you can set the OnChange property of the text control like Text -> OnChange -> Set(ShowValueTrue,true)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

One thing there isn't any text field within the dropdown box. But I added one in right now and added in the formula. Below is the error message that's being shown on the screen when I put in the formula If(ShowValueTrue, LookUp(RHT_Projects.'Contract.No')) .

Screenshot (259).png

As you can see from the image, I just added a text field for the purpose of putting in the formula to sent, but as you can see from the drop-down box the value is displayed on it which is why I didn't need the text box in the first place. Also you can see the error relating to the default function of the drop-down box. 

@SandraAkujobi 

 

The purpose of adding the text box was just an example to identify when we need to show the default value. After the form is reset, when do you want to show the default value?

Also, the lookup expression used is not proper as per LookUp function definition. Can you share more details about the logical implementation, maybe through an example, so that we might be able to help you better.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 After the form is reset there should be no value shown unless a person clicks on a value themselves.  So what I did previously was remove the lookup field since I changed it on the SharePoint list to a single line of text. on power apps I added a new connection with another list that holds the contract numbers and on the app itself I added a drop down box in the new contract field. 

The item function I added : RHT_Projects.'Contract No.'

Default function I added: ThisItem.Contract

 

After doing all that I was able to get the contracts from the other list. Now the issue I'm having is that whenever I start a new weekly entry a default contract no 30002 appears without anyone clicking on it, whenever they save their entry and forget to put in a contract number on the view page that contract number appears would could cause a misunderstanding to people so what I want was to find a way to get rid of that default number that appears whenever you start new weekly entry.

 

 

@SandraAkujobi 

 

I am understanding this right, the form is showing default value even in New Mode? If so, can you reset the form on the button/action where you are setting the form state to new. 

Expression: ResetForm(Form1);NewForm(Form1)

 

You can also set the Default property of the datacard to: If(FormName.Mode = FormMode.Edit, ThisItem. Contract)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hello @yashag2255 where would I actually put the expression: ResetForm(Form1);NewForm(Form1) because I have no button for the contract number.

@yashag2255 I tried putting in the formula in the reset function for the contract dropdown but it came up as an error. So I'm quite confused as to where to put the formula; ResetForm(Form1);NewForm(Form1).

 The formula itself seems to be incorrect as it shows a red line under it when put in the formula box, It says that (behaviour function is a non behaviour property). 

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 (2,277)