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

how to make a yes/no field on an existing field

Hello,

In the field "next appointment",

 

rdv.png

Screenshot_19.png


I'd like to have the opportunity to choose whether or not there's a next appointment.

 

  • If there is a next appointment I press Yes  ➡️ I have the possibility to choose the date as you can see at the moment.
  • If there is no next appointment I press No ➡️ a message indicating "no appointment is scheduled" is recorded.

 

thanks for your help,

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Re: how to make a yes/no field on an existing field

Hi @Ryder 

Your screenshot shows that the field is required.  You must change this to not required as the field should be blank if no appt is required.  Unlock the card containing the date field.  Add a toggle control to the card and set the properties as follows:

FalseText: 'No future appt necessary'
TrueText: 'Make future appt'
OnCheck: 'UpdateContext({showappt:true})
Visible: !showappt
Default: false
Select all of the controls in the card and set their Visible properties to showappt

Set the OnVisible property of the screen to UpdateContext({showappt:false})

Set the OnSuccess property of the form to Reset(Toggle1)

Based on these instructions, when the screen is displayed, the toggle will show No future appt necessary. When the toggle is checked, then it will disappear and the date and time controls will become visible. Once the data in the form is saved, the toggle will reset back to No appt necessary and become visible when the screen is reopened. 

Annotation 2020-05-16 083157.jpgAnnotation 2020-05-16 083233.jpg

View solution in original post

Highlighted
Super User
Super User

Re: how to make a yes/no field on an existing field

Hi @Ryder 

I think we are getting closer.  Rather than mess with the Edit screen, what if you controlled the visibility in the Display form based on a date only being shown if it is in the future.  I'm guessing here but what if you set the Visible property of the date item in the display screen to Date >= Today().  As an alternative, The Visible property of the card in the Display form as  DateDiff(Today(),futureApptDate)>0
BTW, you shouldn't use "Date" as the name of a field because it is a reserved function in PowerApps and could lead to confusion.  Something like futureApptDate would be more appropriate. 

View solution in original post

8 REPLIES 8
Highlighted
Super User
Super User

Re: how to make a yes/no field on an existing field

Hi @Ryder 

Your screenshot shows that the field is required.  You must change this to not required as the field should be blank if no appt is required.  Unlock the card containing the date field.  Add a toggle control to the card and set the properties as follows:

FalseText: 'No future appt necessary'
TrueText: 'Make future appt'
OnCheck: 'UpdateContext({showappt:true})
Visible: !showappt
Default: false
Select all of the controls in the card and set their Visible properties to showappt

Set the OnVisible property of the screen to UpdateContext({showappt:false})

Set the OnSuccess property of the form to Reset(Toggle1)

Based on these instructions, when the screen is displayed, the toggle will show No future appt necessary. When the toggle is checked, then it will disappear and the date and time controls will become visible. Once the data in the form is saved, the toggle will reset back to No appt necessary and become visible when the screen is reopened. 

Annotation 2020-05-16 083157.jpgAnnotation 2020-05-16 083233.jpg

View solution in original post

Highlighted
Helper III
Helper III

Re: how to make a yes/no field on an existing field

hi @Drrickryp ,

 

It works perfectly! 😀


Thank you for your help and your time

Highlighted
Helper III
Helper III

Re: how to make a yes/no field on an existing field

@Drrickryp ,

I've just noticed a small detail on the other hand once I validate the form without indicating a date.

 

Screenshot_24.png


The result still shows me a date by default, should I adjust the "update" or something else not ?

Highlighted
Super User
Super User

Re: how to make a yes/no field on an existing field

@Ryder 

You will need to change the Update property to account for a blank date.  Something like

 

If(
    IsBlank(DateValue3.SelectedDate),
    Blank(),
    DateValue3.SelectedDate + Time(
        Value(HourValue3.Selected.Value),
        Value(MinuteValue3.Selected.Value),
        0
    )
)

 

Make sure you have removed the required property for the field or PowerApps will try to insert the current date and time in the field.

Highlighted
Helper III
Helper III

Re: how to make a yes/no field on an existing field

@Drrickryp ,

 

unfortunately the same result

Screenshot_26.png

Screenshot_27.png

Highlighted
Super User
Super User

Re: how to make a yes/no field on an existing field

Hi @Ryder 

I think we are getting closer.  Rather than mess with the Edit screen, what if you controlled the visibility in the Display form based on a date only being shown if it is in the future.  I'm guessing here but what if you set the Visible property of the date item in the display screen to Date >= Today().  As an alternative, The Visible property of the card in the Display form as  DateDiff(Today(),futureApptDate)>0
BTW, you shouldn't use "Date" as the name of a field because it is a reserved function in PowerApps and could lead to confusion.  Something like futureApptDate would be more appropriate. 

View solution in original post

Highlighted
Helper III
Helper III

Re: how to make a yes/no field on an existing field

@Drrickryp ,

 

It's working!

 

a big thank you for your help and patience

Highlighted
Super User
Super User

Re: how to make a yes/no field on an existing field

De rien mon ami.

smiling.gif

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,142)