cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EMARIN91
Level: Powered On

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
Super User
Super User

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!
3 REPLIES 3
Highlighted
Mike8
Level 10

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) 

Super User
Super User

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!
EMARIN91
Level: Powered On

Re: Validation of empty TextInputs in a Gallery

Thank you very much, your code was very helpful.