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

Require data card value based on another field

i have a data card which has three input boxes, based on the answer of another field they may vary which is define in the visible property. how can i set the on required property true for the visible field. 

arshad2_0-1658892519790.pngarshad2_1-1658892554782.pngarshad2_2-1658892591670.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @arshad2 ,

 

As per saying in the official doc:

https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/controls/control-card#key-properties

Required – Whether a card, editing the field of a data source, must contain a value.

 

When "Required" of the Card set to true, it means this Card need value other than blank for submission. The value comes from the controls within this Card and update to data source depends on the Update property. So, as per your scenario, you will need to use the Update property of this Card to determine what value need to be updated. In short words, Controls required or not depend on whether the value of them will be updated in the Card's Update property.

 

I'm not aware of how the visible of the Controls are performing, but basically you will need an If statement on Update of the Data Card to check the Visible of each control and determine whether the value of it is going to be updated to data source:

If(ddFor, ddFor.Selected.Result, nameInput.Visible, concatenate(nameInput.Text, ddID.Text))

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

7 REPLIES 7
Akash17
Continued Contributor
Continued Contributor

Hi @arshad2 

I am assuming that you want to show or hide 'Transport request for' dropdown based on user type selected in the user type dropdown

in order to achieve this simply go to the 'Transport request for' dropdown on visible property of that 'Transport request for' dropdown apply If(DataCardValueOfUserTypeDropdown.Selected.Value="Employee",true,false)

 

so now in the dropdown if you select Employee only then this 'Transport request for' dropdown  will be visible

If you have different scenario let me know

If you got your answer please accept as a solution and like
Thank you

@Akash17 ,

my visible property works fine, but i want to make the particular input field required based on the answer of the other field. 

Please let me know if you dont understand!

thank you

Akash17
Continued Contributor
Continued Contributor

Yes now I got your scenario 

select your complete datacard of 'Transport request for' which you want to make it required there is one property called Required there you can apply if condition

DataCardValueOfUserTypeDropdown.selected.value="Employee"

for more please refer this link

 

https://www.youtube.com/watch?v=aVEaRpAlaTA&t=1s

go to 15th minute of video you will get your scenario

@Akash,

i have tried that but for my senario it is not working, can i define which input field is required using if condition. imagine i have 3 input field, if i select employee, the required field is combox1 and combox2. can i define the required field based on the data card value field.

Akash17
Continued Contributor
Continued Contributor

Considering my scenario If user select product category as 'Electronics' and Is Discount as 'yes' then my discount field becomes mandatory and the If condition i have added on the required property of Discount card
This is my scenario just hoping this will help you and you can correlate it with your scenario

 

Screenshot (14).png

my issue is i have three input boxes within one data card:

arshad2_0-1658899395872.pngarshad2_1-1658899454182.pngarshad2_2-1658899580246.png

i want to specifically make the type of field required based on the answer of the other field. for example: answer A of the other field should make the 2nd and 3rd field but the 1st field is not required.

 

thanks @Akash17 

v-jefferni
Community Support
Community Support

Hi @arshad2 ,

 

As per saying in the official doc:

https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/controls/control-card#key-properties

Required – Whether a card, editing the field of a data source, must contain a value.

 

When "Required" of the Card set to true, it means this Card need value other than blank for submission. The value comes from the controls within this Card and update to data source depends on the Update property. So, as per your scenario, you will need to use the Update property of this Card to determine what value need to be updated. In short words, Controls required or not depend on whether the value of them will be updated in the Card's Update property.

 

I'm not aware of how the visible of the Controls are performing, but basically you will need an If statement on Update of the Data Card to check the Visible of each control and determine whether the value of it is going to be updated to data source:

If(ddFor, ddFor.Selected.Result, nameInput.Visible, concatenate(nameInput.Text, ddID.Text))

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

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.

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 (4,207)