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

Can date picker value be set to null? Working with is date blank

Hello,

I have a gallery set up like a repeating table. Meaning editable form field in each item.

Attempting to set up something like this example: April Dunham - Edit Tables

 

Trying accomplish using the toggle to filter against.

TOGGLE = true     when either the comment text or date picker are not blank

TOGGLR = false   when both the comment text or date picker are blank

Both SharePoint columns are blank in the list by default

Comments  is a multiline TextInput

SERVICE DATE COMPLETE is a DatePicker

with Default property  ThisItem.SERVICE DATE COMPLETE,

and InputHint has nothing in the formula

 

In the end I am trying to accomplish this:
ForAll(Filter(GalleryName.AllItems,Toggle.Vlaue=true),
Patch(TableName,
ThisRecord,{Comments:TextInput_Comments.Text, SERVICE DATE COMPLETE:DatePicker5.SelectedDate}))

Toggle Default property I have tried but did not work:  I know these need ot be placed in an Or statement, but they don't function on their own


ThisItem.Comments<>TextInput_Comments.Text

ThisItem.SERVICE DATE COMPLETE<>DatePicker.SelectedDate
ThisItem.SERVICE DATE COMPLETE<>IsBlank(DatePicker.SelectedDate)
 

One attempt at the toggle propertyOne attempt at the toggle propertyDatePicker has to tie to item 'SERVICE DATE COMPLETE"DatePicker has to tie to item 'SERVICE DATE COMPLETE"

 

Any help is appreciated - because I am stuck

1 REPLY 1
RandyHayes
Super User III
Super User III

@DublinOH_User 

Are you stating that you want the toggle to be off if the selected date is empty?

I assume you are using a toggle to indicate a changed or valid record in order to update your list.

 

Is so, the formula on the Default for the Toggle should be:

((ThisItem.Comments <> TextInput_Comments.Text) && 
 !(IsBlank(TextInput_Comments.Text))
) ||

((ThisItem.'SERVICE DATE COMPLETE' <> DatePicker.SelectedDate) && 
 !(IsBlank(DatePicker.SelectedDate))
)

This will set the toggle to true if the Comments are not the same as the original and the comments input are not blank OR if the date is not the same and the selected date is not blank.

 

I am not entirely sure if that logic is what you want, but the And's and the Or's can be altered to give you exactly what you are looking for.

 

Your final "accomplish this" should be:

Patch(TableName,
    ForAll(Filter(GalleryName.AllItems,Toggle.Value) As _item,
       {ID: _item.ID,
        Comments: _item.TextInput_Comments.Text, 
        'SERVICE DATE COMPLETE': _item.DatePicker5.SelectedDate
       }
    )
)

Your previous formula was producing a table that was then wasted.  ForAll produces a table and should be used as such, not as a For/Loop statement.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,760)