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

Help me Navigate( out from ForAll( loop

I have gallery in my app where users have to provide names. 
Capture4.PNG
Thank to help in some other topic I manage to made the names field mandatory. 

But unfortunately due the some PowerApp functionality and mine personal not understanding it I can't Navigate( out to the next screen if user successfully fill the name fields. I would be helpfully for any directions:

 

Set(BookingDate, Text(Now()+1,"[$-en-US]dd/mm/yyyy"));

If(
    IsEmpty(Filter(GalChoiceDeskMulti.AllItems,IsBlank(TextInput2))),
       ForAll
            (GalChoiceDeskMulti.AllItems,Patch(MultiDeskSelection,LookUp([@MultiDeskSelection], Subtitle4.Text=DeskNumber ),
            {UserName: TextInput2.Text,
            UserID: UserIDVariable,
            Date: BookingDate })), Notify("Names are mandatory",NotificationType.Error));

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
KrishnaV
Super User III
Super User III

Hi @m0le ,

 

try this:

If(
    IsEmpty(Filter(GalChoiceDeskMulti.AllItems,IsBlank(TextInput2))),
       ForAll
            (GalChoiceDeskMulti.AllItems,Patch(MultiDeskSelection,LookUp([@MultiDeskSelection], Subtitle4.Text=DeskNumber ),
            {UserName: TextInput2.Text,
            UserID: UserIDVariable,
            Date: BookingDate }));Navigate(screen2), Notify("Names are mandatory",NotificationType.Error));

Note: I am assuming that TextInput2 is where you are reading name on the gallery.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

5 REPLIES 5
KrishnaV
Super User III
Super User III

Hi @m0le ,

 

try this:

If(
    IsEmpty(Filter(GalChoiceDeskMulti.AllItems,IsBlank(TextInput2))),
       ForAll
            (GalChoiceDeskMulti.AllItems,Patch(MultiDeskSelection,LookUp([@MultiDeskSelection], Subtitle4.Text=DeskNumber ),
            {UserName: TextInput2.Text,
            UserID: UserIDVariable,
            Date: BookingDate }));Navigate(screen2), Notify("Names are mandatory",NotificationType.Error));

Note: I am assuming that TextInput2 is where you are reading name on the gallery.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

WarrenBelz
Super User III
Super User III

Hi @m0le ,

You seem to have your logic backwards, but it would be something like the below

If(
   IsEmpty(
   Filter(
      GalChoiceDeskMulti.AllItems,
      IsBlank(TextInput2)
      )
   ),
   ForAll
      (
         GalChoiceDeskMulti.AllItems,
         Patch(
         MultiDeskSelection,
         LookUp(
         [@MultiDeskSelection], 
            Subtitle4.Text=DeskNumber
         ),
         {
            UserName: TextInput2.Text,
            UserID: UserIDVariable,
            Date: BookingDate
         }
      )
   );
   Navigate(YourNextScreen), 
   Notify(
      "Names are mandatory",
      NotificationType.Error
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

mdevaney
Super User III
Super User III

@m0le 

Put this code in the OnSelect property of your Submit button directly after your current code..  It will check for any blanks in the Text property of each Text Input before navigating to the next screen.

 

 

If(!(Blank() in Gallery1.AllItems.TextInput.Text), Navigate(your_screen_name))

 

---
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."

Thanks, that worked form me

KrishnaV
Super User III
Super User III

Hi @m0le ,

 

I am happy that your issue got resolved, would you min mark the relevant reply mark as a solution so that the new members of the community.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (21,431)