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

Advice and guidance please on validation question?

Hi,

 

I have a APP that has multiple fields on it. 

 

DATE 1             TEXT 1               DESC 1

DATE 2             TEXT 2               DESC 2

DATE 3             TEXT 3               DESC 3

 

The dates are done my a date picker, Desc and text both multi-line texts.

These are the rules I need to follow:-

If text or desc Blank on row then ignore date and accept.

If either Text or desc empty, then the other text field must contain something, and the date must be today or later.

 

If any of the above fail validation, then the submit bit should be set to view mode.

The issue is how would I achieve the above please? What advice do you have?

 

NB my PA knowledge is limited.

1 ACCEPTED SOLUTION

Accepted Solutions

@mdevaney 

 

Thank you, I eventually got this working thanks. Needed a couple more ands etc. 

 

Many thanks for all the assistance and help.

View solution in original post

8 REPLIES 8
Super User III
Super User III

@MarkIreland 
Are the fields inside of a gallery?  Or did you place them directly on the canvas?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

In a form, directly on the canvas.

Super User III
Super User III

@MarkIreland 
Your requirements are

If text or desc Blank on row then ignore date and accept.

If either Text or desc empty, then the other text field must contain something, and the date must be today or later.

The validation code here should be used in the DisplayMode property of the button.

If(
    ((DatePicker1.SelectedDate >= Today() !IsBlank(Text1.Text) And !IsBlank(Description1.Text))
    Or (IsBlank(Text1.Text) And IsBlank(Description1.Text)))
    And ((DatePicker2.SelectedDate >= Today() !IsBlank(Text2.Text) And !IsBlank(Description2.Text))
    Or (IsBlank(Text2.Text) And IsBlank(Description2.Text)))
    And ((DatePicker3.SelectedDate >= Today() !IsBlank(Text3.Text) And !IsBlank(Description3.Text))
    Or (IsBlank(Text3.Text) And IsBlank(Description3.Text))),
    DisplayMode.Edit,
    DisplayMode.View
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

@mdevaney 

 

Thank you I will give that a try.

Hi,

 

This did not work at all.

 

If(
((DataCardValue7.SelectedDate > Today() !IsBlank(DataCardValue20.Text) And !IsBlank(DataCardValue26.Text))
Or (IsBlank(DataCardValue20.Text) And IsBlank(DataCardValue26.Text)))
And ((DataCardValue10.SelectedDate > Today() !IsBlank(DataCardValue17.Text) And !IsBlank(DataCardValue18.Text))
Or (IsBlank(DataCardValue17.Text) And IsBlank(DataCardValue18.Text)))
And ((DataCardValue13.SelectedDate > Today() !IsBlank(DataCardValue15.Text) And !IsBlank(DataCardValue16.Text))
Or (IsBlank(DataCardValue15.Text) And IsBlank(DataCardValue16.Text))),
DisplayMode.Edit,
DisplayMode.View
)

 

Anything obvious please?

 

Mark

 

@MarkIreland 
I don't see anything obvious.

 

My suggestion would be to try breaking the problem into smaller pieces by taking my code and writing the conditions for a single row.  If that's not working just try writing a single condition for the row.

If(
    ((DataCardValue7.SelectedDate > Today() !IsBlank(DataCardValue20.Text) And 
    !IsBlank(DataCardValue26.Text))
    Or (IsBlank(DataCardValue20.Text) And IsBlank(DataCardValue26.Text))),
    DisplayMode.Edit,
    DisplayMode.View
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney 

 

Thank you, I eventually got this working thanks. Needed a couple more ands etc. 

 

Many thanks for all the assistance and help.

View solution in original post

@MarkIreland 

Can you please post the solution to this thread and close it so others know it was answered?

 

Thanks in advance 🙂

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,029)