Navigate between screens based on checkbox value on power apps

Étiquetté : 

  • Navigate between screens based on checkbox value on power apps

    Posté par Ahmed Njimou sur 21 juin 2022 à 14h28

    Hello Everyone
    I want to navigate between screen in my application power app, the first screen is this :

    And based on the checkbox selected, i want to navigate to it. And also navigate between the for screens if more than checkbox is selcted. For example, if i check the first and the last one, i want to go to the screen of the first one, then the screen of the last one. I want to do all the possibility, i tried this code but it’s not working

    Can someone help with this please, thank you in advance !

    PostID=7o23zXbRD74XcQt

    R3dKap a répondu Il y a 9 mois, 3 semaines 1 Membre · 7 Réponses
  • 7 Réponses
  • DavidZed

    Membre
    21 juin 2022 à 14h57

    Hello,

    By “navigate to multiple screens”, you mean display multiple screen at the same time ? Or you want to save a navigation path between screens ?

    Bonjour,

    Par naviguer vers plusieurs écrans, tu veux dire afficher plusieurs écrans à la fois ? ou tu souhaites faire un cheminement de navigation entre les écrans ?

    CommentID=SMxW52W2Bnv2yC1, PostID=7o23zXbRD74XcQt

  • Ahmed Njimou

    Membre
    21 juin 2022 à 15h11

    Bonjour David,

    je souhaites faire un cheminement de navigation entre les écrans, on se basant sur les checkboxe selected. Par exemple si on sélectionne Réservoir vertical HCL, Pomperie et DCI, ça doit me ramener au 3 screens par ordre. Je ne sais pas comment je peux faire toutes les combinaison possible.

    Je vous remercie d’avance !

    CommentID=Hpg1SbdST0vIuoS, PostID=7o23zXbRD74XcQt

  • DavidZed

    Membre
    21 juin 2022 à 15h48

    L’idéal serait de peupler une collection en fonction des check/uncheck

    Sur le oncheck de chaque contrôle :

    Collect(ColNav,{NumeroEcran: 1,Ecran:'nom de l'écran concerné})

    Sur le onuncheck de chaque contrôle :

    Remove(ColNav,,{NumeroEcran: 1,Ecran:'nom de l'écran concerné})

    Et sur le onselect de ton bouton Next :

    Collect(ColNav,{NumeroEcran: Countrows(ColNav)+1,Ecran:'Ecran de fin'});//on ajoute lécran final comme derniere étape de navigationnSet(VNavig,{Actuel:1,Total:Countrows(ColNav)}); //On stocke la page actuelle et le nombre de pages au total dans une variablenNavigate(Lookup(ColNav,NumeroEcran=VNavig.Actuel,Ecran)) //Navigation vers le 1er ecran de la collection

    Ensuite, sur chaque page, un bouton next avec :

    Set(VNavig,{Actuel:VNavig.Actuel+1,Total:Countrows(ColNav)});If(VNavig.Actuel>VNavig.Total,Navigate(HomeScreen),nNavigate(Lookup(ColNav,NumeroEcran=VNavig.Actuel,Ecran))// Si la page actuelle est supérieure au nombre total de pages, on retourne à l'écran d'accueil, sinon on navigue à la page suivante

    CommentID=MlLZorBv6hoN2a3, PostID=7o23zXbRD74XcQt

  • Ahmed Njimou

    Membre
    22 juin 2022 à 8h45

    Bonjour David,

    je vous remercie pour votre réponse, j’ai essayé votre code mais ça s’arrête au premier screen, et je dois absolument cocher le premier chechbox sinon ça se passe rien.

    CommentID=3TnAEcTxobE2rZY, PostID=7o23zXbRD74XcQt

  • DavidZed

    Membre
    22 juin 2022 à 10h01

    Ah, je vois où est l’erreur,

    Dans le Oncheck, remplacer :

    Collect(ColNav,{NumeroEcran: 1,Ecran:'nom de l'écran concerné})

    par:

    Collect(ColNav,{NumeroEcran: Countrows(ColNav)+1,Ecran:'nom de l'écran concerné})

    et sur les onuncheck, remplacer :

    Remove(ColNav,{NumeroEcran: 1,Ecran:'nom de l'écran concerné})

    par :

    RemoveIf(ColNav,Ecran='nom de l'écran concerné')

    L’utilisateur devrait naviguer à travers les écrans dans l’ordre dans lequel il les a cochés

    CommentID=tVGXzXLDbiLJrTV, PostID=7o23zXbRD74XcQt

  • Ahmed Njimou

    Membre
    22 juin 2022 à 13h38

    Merci pour votre réponse, j’ai modifié le code mais ça ne marche toujours pas. ça prends en compte que si on sélectionne le premier checkbox, sinon ça ne marche pas.

    CommentID=VKKnw4L1Z6ZAmVP, PostID=7o23zXbRD74XcQt

  • R3dKap

    Membre
    29 juin 2022 à 20h44

    Salut Ahmed Njimou,

    Si tu as toujours un souci là-dessus voici comment je procèderais (mets tes propres noms de checkbox et d’écrans)…

    CheckboxRéservoir.OnCheck = Collect(colNav; {Ordre: 1; Ecran: EcranRéservoir})nnCheckboxRéservoir.OnUncheck = Remove(colNav; {Ordre: 1; Ecran: EcranRéservoir})nnCheckboxPoste.OnCheck = Collect(colNav; {Ordre: 2; Ecran: EcranPoste})nnCheckboxPoste.OnUncheck = Remove(colNav; {Ordre: 2; Ecran: EcranPoste})nnCheckboxPomperie.OnCheck = Collect(colNav; {Ordre: 3; Ecran: EcranPomperie})nnCheckboxPomperie.OnUncheck = Remove(colNav; {Ordre: 3; Ecran: EcranPomperie})nnCheckboxDCI.OnCheck = Collect(colNav; {Ordre: 4; Ecran: EcranDCI})nnCheckboxDCI.OnUncheck = Remove(colNav; {Ordre: 4; Ecran: EcranDCI})

    Ecran d’accueil (celui avec tes checkbox)

    EcranAccueil.OnVisible = Clear(colNav);; Reset(CheckboxRéservoir);; Reset(CheckboxPoste);; Reset(CheckboxPomperie);; Reset(CheckboxDCI)nnBoutonNext.OnSelect = ClearCollect(colNav; Sort(colNav; Ordre));; Set(gloNavIndex; 1);; Navigate(Index(colNav; gloNavIndex).Ecran)

    Ecran Réservoir

    BoutonNextRéservoir.OnSelect = Set(gloNavIndex; gloNavIndex+1);; Navigate(If(gloNavIndex > CountRows(colNav); Home; Index(colNav; gloNavIndex).Ecran))

    Et mets ce même code sur chacun des boutons NEXT des écrans Poste, Pomperie et DCI.

    Voilà, j’ai testé chez moi ça marche… 😉

    CommentID=924ZpiD6tZZpx55, PostID=7o23zXbRD74XcQt

Connectez-vous pour répondre.