cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Validation of empty TextInputs in a Gallery

Hello everyone,
I have created a Gallery to which I have inserted two TextInputs to take millimeter and pressure data of the tires of a vehicle.
What I need is a formula that validates all the TextInputs in the Gallery, and if in a given case there is one or more empty TextInputs the Collection can not be saved and do not pass to the next screen.

The conditional formula that I am using in a button is the following:

If (TextInput_mm.Text = "" Or TextInput_psi.Text = ""; Navigate (Alerta_Validacion; ScreenTransition.Cover); ClearCollect (LlantasMP; ForAll (Gallery_Llantas4.AllItems; {IdLlanta: IdLlanta; Millimeters: TextInput_mm.Text; Pressiones: TextInput_psi. Text})) ;; Navigate ('Semanal (Mptor)'; ScreenTransition.Cover))

Captura.PNG

This formula is only validating correctly the first 02 TextInputs of the first rim (TextInput_mm and TextInput_psi), but not with the others.
 



 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Validation of empty TextInputs in a Gallery

Hi @EMARIN91 

 

Can you please modify your expression as:
Clear(LlantasMP);
ForAll(
    Gallery_Llantas4.AllItems;
    If(
        !IsBlank(TextInput_mm.Text) && !IsBlank(TextInput_psi.Text);
        Collect(LlantasMP;
        {
            IdLlanta: IdLlanta; 
            Millimeters: TextInput_mm.Text; 
            Pressiones: TextInput_psi. Text
        }
        )
    )
    );
If(CountRows(Gallery_Llantas4.AllItems) = CountRows(LlantasMP); Navigate ('Semanal (Mptor)'; ScreenTransition.Cover);Navigate (Alerta_Validacion; ScreenTransition.Cover))
This iterates over all the items in the Gallery and collects the collection. At the end checks the condition if all Gallery items were added to collection, then navigate to 'Semanal (Mptor)' screen, else navigates to 'Alerta_Validacion' screen.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Validation of empty TextInputs in a Gallery

Hello,

You can try instead of 

TextInput_mm.Text = "" Or TextInput_psi.Text = ""

the following:
LookUp(Gallery_Llantas4.AllItems,IsBlank(TextInput_mm.Text)||IsBlank(TextInput_psi.Text),true) 

Highlighted
Dual Super User III
Dual Super User III

Re: Validation of empty TextInputs in a Gallery

Hi @EMARIN91 

 

Can you please modify your expression as:
Clear(LlantasMP);
ForAll(
    Gallery_Llantas4.AllItems;
    If(
        !IsBlank(TextInput_mm.Text) && !IsBlank(TextInput_psi.Text);
        Collect(LlantasMP;
        {
            IdLlanta: IdLlanta; 
            Millimeters: TextInput_mm.Text; 
            Pressiones: TextInput_psi. Text
        }
        )
    )
    );
If(CountRows(Gallery_Llantas4.AllItems) = CountRows(LlantasMP); Navigate ('Semanal (Mptor)'; ScreenTransition.Cover);Navigate (Alerta_Validacion; ScreenTransition.Cover))
This iterates over all the items in the Gallery and collects the collection. At the end checks the condition if all Gallery items were added to collection, then navigate to 'Semanal (Mptor)' screen, else navigates to 'Alerta_Validacion' screen.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Frequent Visitor

Re: Validation of empty TextInputs in a Gallery

Thank you very much, your code was very helpful.

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 (5,752)