Clear fields based on drop-down values in PowerApps

Clear current selection from drop down when another drop down value changes

1) Parent drop-down is States
2) Child drop-down is City

We can hide and show the City drop-down based on States Value changes
NOTE: Please use your DataCardValues and lv_dpclear is local variable


  • Select City data card and go to the Advanced properties for DataCard
  • Look for the Visible property and write the below code


If(DataCardValue3.Selected.Value="VA",true,false)


  • For clearing the City dropdown selected value based state changes.



  • Select the State drop-down (first drop-down) and go to Advanced
  • use the below code in OnChange 

UpdateContext({lv_dpclear: true}); UpdateContext({lv_dpclear: false}) 

  • In the Reset property of the second dropdown(City), add the below code

      lv_dpclear



--------------------------------------------------------------------


Clearing text box and Date Control values based on dropdown selection:


Add below code in drop-down OnChange 

Reset(DataCardValue47)

Reset((DataCardValue28)


Note: DataCardValue47  is Text box DataCard value.


          DataCardValue28 is Data picker DataCard value
----------------------------------------------------------------------


Set Radio button default values:

If(SharePointForm1.Mode=FormMode.New,Blank(),ThisItem.Internal_x0020_or_x0020_External.Value)

OR

Set the Default property of the 1.1_Last Inspection Reviewed? Radio button to following:

If(
    EditForm1.Mode=FormMode.New,
    Blank(),
    ThisItem.1.1_Last Inspection Reviewed?
)
------------------------------------------------------


------------------------------------------------------------
Set Date Picker value to today date
If(SharePointForm1.Mode=FormMode.New,Today(),Parent.Default)
 or
If(SharePointForm1.Mode=FormMode.New,Today(),ThisItem.DateOfInteraction)

Comments

Popular posts from this blog

SharePoint 2016 and 2019 Ports

Hide a SharePoint list field based on user group using JQuery Webservice in 2010