Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Navigation issues

(1) ShareShare
ReportReport
Posted on by 2,161
I have previous button and the below formula is not working for step 1.2 and please help as its skipping step 1.2
 
 
Set(varReviewAndSubmit,true);
If(varStep=2 && !First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box',Set(varStep,varStep-0.9),
varStep=2 && First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box',Set(varStep,varStep-1),
varStep=1.1,Set(varStep,varStep-0.1),
Set(varStep,varStep-1))
 
 
Note: We are using one form and we have conditional navigation where each controls in each step will be visible based on the conditional left side navigation
 
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,475 on at
    Navigation issues
    The below is more a guidance on how to write condensed code - I cannot see your data nor understand your logic for setting varStep (or anything else), but this might be helpful - it is also free-typed, so watch commas and brackets (you will need to sort out any errors)
    If(
       varStep > 1 && varStep <= Last(ReviewersGallery1.AllItems).Step,
       Set(
          varShowLoader,
          true
       );
       Set(
          varStep,
          1
       ); 
       Set(
          varIsDraft,
          false
       );
       If(
          varFormMode <> FormMode.New && Value(varItemSetupID) > 0,
          Set(
             varFormMode,
             FormMode.Edit
          );
          ClearCollect(
             colItemSetupSelectedRecord,
             LookUp(
                'Item Setup Data',
                ID = varItemSetupID
             )
          ),
          ClearCollect(
             colItemSetupSelectedRecord,
             LookUp(
                'Item Setup Data',
                ID = galItemSetupRequests.Selected.ID
             )
          )
       );
       With(
          {
             _Item:
             LookUp(
                'Item Setup Data',
                ID = First(colItemSetupSelectedRecord).ID
             ),
             _Record: First(colItemSetupSelectedRecord),
             _Edit: varFormMode = FormMode.Edit,
             _ID0: First(colItemSetupSelectedRecord) > 0
          },
          Set(
             varStep,
             If(
                (
                   _Item.'HavePMapproved?' && _Item.'IsAppCompleted?' && _Item.'IsProcurementCompleted?' && _Item.'IsPMCompleted?' && 
      _Item.'Is Customer Care Completed' && _Item.'Is it added to 365?' && _Item.'Completed by PoM?' ) || _Record.ApprovalStatus = "Reviewed" || ( _Record.ApprovalStatus = "Submitted" && _Record.'If item is in catalog or a drawing exists then Product approval is not required, Check the box' ), 2, _Edit && _ID0 && _Item.'IsAppCompleted?', 3, _Edit && _ID0 && _Item.'IsProcurementCompleted?', 4, _Edit && _ID0 && _Item.'IsPMCompleted?', 5, _Edit && _ID0 && _Item.'Is Customer Completed', 6, _Edit && _ID0 && _Item.'Completed by PoM?', 7, _Edit && _ID0 && _Item.'IshrCompleted?', 8, _Edit && _ID0 && (_Item.'IsInvCompleted?' ||_Item.IsPoMRemoveHoldCompleted), 9, _Edit && _Record.ApprovalStatus = "Submitted" && !_Record.'If item is in catalog or a drawing exists then Product approval is not required, Check the box', 1.2, _Edit && _Record.ApprovalStatus = "Submitted" && _Record.'I do not know vendor name', 1.1, _Edit && _Record.ApprovalStatus = "Submitted" && _Record.'If item is in catalog or a drawing exists then Product approval is not required, Check the box' &&
    _Record.'IsSourcingCompleted?', 2, varFormMode = FormMode.New Or _Record.ApprovalStatus = "Rejected", 1 ) ); Set( varShowLoader, false ) ) );
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Veblitz Profile Picture
    Veblitz 2,161 on at
    Navigation issues
    We write the below condition in the newform ->Visible property
     
     
    varStep > 1 && varStep <= Last(ReviewersGallery1.AllItems).Step



    Set(varShowLoader,true);
    Set(varStep,1); // allow showing different fields at multiple steps of forms
    Set(varIsDraft,false);
    If (varFormMode <> FormMode.New,
    If(Value(varItemSetupID)>0,
    Set(varFormMode,FormMode.Edit);
    ClearCollect(colItemSetupSelectedRecord,LookUp('Item Setup Data',ID=varItemSetupID)),
    ClearCollect(colItemSetupSelectedRecord,LookUp('Item Setup Data',ID=galItemSetupRequests.Selected.ID))));
    If(
    (LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'HavePMapproved?' &&
        LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IsAppCompleted?' &&
        LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IsProcurementCompleted?' &&
        LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IsPMCompleted?' &&
        LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'Is Customer Care Completed' &&
        LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'Is it added to 365?' &&
        LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'Completed by PoM?') Or First(colItemSetupSelectedRecord).ApprovalStatus="Reviewed" Or
        (First(colItemSetupSelectedRecord).ApprovalStatus="Submitted" && First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box')
        ,
        Set(
            varStep,
            2
        ));

    If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ID > 0 && LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IsAppCompleted?',
        Set(
            varStep,
            3
        ));
        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ID > 0 && LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IsProcurementCompleted?',
        Set(
            varStep,
            4
        ));
        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ID > 0 && LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IsPMCompleted?',
        Set(
            varStep,
            5
        ));    
        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ID > 0 && LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'Is Customer Completed',
        Set(
            varStep,
            6
        ));
        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ID > 0 && LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'Completed by PoM?',
        Set(
            varStep,
            7
        ));
        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ID > 0 && LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IshrCompleted?',
        Set(
            varStep,
            8
        ));
        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ID > 0 && Or(LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).'IsInvCompleted?',LookUp(
            'Item Setup Data',
            ID = First(colItemSetupSelectedRecord).ID
        ).IsPoMRemoveHoldCompleted),
        Set(
            varStep,
            9
        ));    
        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ApprovalStatus="Submitted" && !First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box', Set(varStep,1.2));

        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ApprovalStatus="Submitted" &&
        First(colItemSetupSelectedRecord).'I do not know vendor name',
       
        Set(varStep,1.1));

        If(varFormMode=FormMode.Edit &&
        First(colItemSetupSelectedRecord).ApprovalStatus="Submitted" && First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box' && First(colItemSetupSelectedRecord).'IsSourcingCompleted?', Set(varStep,2));

        If(varFormMode = FormMode.New
         Or First(colItemSetupSelectedRecord).ApprovalStatus="Rejected", Set(varStep,1)    
         );

    Set(varShowLoader,false);
  • Veblitz Profile Picture
    Veblitz 2,161 on at
    Navigation issues
    Yes I hope i understood your question.
     
    Please free to reach me if you need details to below points i mentioned
     
    Firstly,we have designed this app with step 1 that has new form logic of submitting data nextly step 1.1 which has some visibility on or off for vendor name controls so just disabling if user checks I don't know vendor name so these controls are enabled in step 1.1 at basic level this is the logic 
     
    For button navigation previous and next  is were navigating to each steps onselect property as given below.
     
    Apart from that we don't have any other conditions or logic for the below app for remaining step 2 to step 8. But I'm not sure but the below steps were working previously but after I included step 1.1 I was facing some issues.
     
     
     
  • WarrenBelz Profile Picture
    WarrenBelz 145,475 on at
    Navigation issues
    I cannot see your app or your logic  - what I was really after is a summary of each possibility of If varStep equals X (and any other conditions such as I have in the With() statement), then I need to change it to Y
     
     
     
     
     
     
  • Veblitz Profile Picture
    Veblitz 2,161 on at
    Navigation issues
    Yes I would need help on varstep been step based on the next button current value and previous button in my usecase based on the selection and for which on select of button wether previous or next it's been rendering the current step controls. So issue I'm facing when I click on step 1.1 so next click  it should display step 1.2 but it's getting skipped . Also we have set the varstep= 1.2  in respective controls which needs to be visible.
     
    In the below steps which I posted as I have put on select property of next button where I managed the condition for navigation.
  • WarrenBelz Profile Picture
    WarrenBelz 145,475 on at
    Navigation issues
    @Veblitz​​​​​​​
    I was expecting something far less complex than that based on the code you posted. I really only need the rules on how varStep is set based on its current value (which is the question you posted).
  • Veblitz Profile Picture
    Veblitz 2,161 on at
    Navigation issues
    Thanks for the inputs.
     
    Kindly refer below the detailed step by step of the same.
     
    Left Navigation 
     
     
     
     
     
    Form Container // Right Side displaying data
     
     
    Text ="Step No : " & varStep
     
     
     
    If(varStep=1,"Requester",varStep=1.1,"Sourcing",varStep=1.2,"Product Management  Approval",varStep=2,"App ",varStep=3,"Buy",varStep=5,"Customer",varStep=4,"Product Management",varStep=6,"PM",varStep=7,"HR",varStep=8,"Control",varStep=9,"Final Review")
     
     
    Default mode of ApproverForm1 
    Default Mode- If(varFormMode<>FormMode.New && First(colItemSetupSelectedRecord).ApprovalStatus="Rejected",FormMode.View,  varFormMode)
     
    Items property
     
    If(varFormMode<>FormMode.New,
    If(Value(varItemSetupID)>0,
    LookUp('Item Setup Data',ID=varItemSetupID),
    LookUp('Item Setup Data',ID=galItemSetupRequests.Selected.ID)))
     
    Visible Property ApprovalForm1
    varStep<=9 && varStep<>1.2
     
     
    On success property ApprovalForm1
     
    Navigate('New Data Dashboard')
     
    Next Button
     
    i)Onselect  property of Next button
    If(varStep=1,Set(varStep,varStep+0.1),
    varStep=1.1,Set(varStep,varStep+0.9),
    Round(varStep,2)=1.2,Set(varStep,varStep+0.8),
    Set(varStep,varStep+1))
     
    ii)Visible Property of Next Button
    If(varStep=1 && varFormMode=FormMode.Edit,true,
        varStep=1.1 && First(colItemSetupSelectedRecord).'IsSourcingCompleted?',true,
        varStep=1.2 && !IsBlank(First(colItemSetupSelectedRecord).PMReviewDate),true,
        varStep=2 && First(colItemSetupSelectedRecord).'IsAppCompleted?',true,
        varStep=3 && First(colItemSetupSelectedRecord).'IsProcurementCompleted?',true,
        varStep=4 && First(colItemSetupSelectedRecord).'Is Customer Completed',true,  
        varStep=5 && First(colItemSetupSelectedRecord).'IsPMCompleted?',true,  
        varStep=6 && First(colItemSetupSelectedRecord).'Is it added to D365?',true,  
        varStep=7 && First(colItemSetupSelectedRecord).'IsHRCompleted?',true,  
        varStep=8 && First(colItemSetupSelectedRecord).'IsInventoryCompleted?',true,false)
     
    Previous Button
    i) Onselect property
    Set(varReviewAndSubmit,true);
    If(varStep=2 && !First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box',Set(varStep,varStep-0.9),
    varStep=2 && First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box',Set(varStep,varStep-1),
    varStep=1.1,Set(varStep,varStep-0.1),
    varStep=1.2,Set(varStep,varStep-0.1),
    Set(varStep,varStep-1))
    ii)Visible property
    varStep > 1 && varStep <= Last(ReviewersGallery1.AllItems).Step
     
    Expected Output:
     
    1)When Requestor which is step1 submit the form ,we are navigating to dashboard.
    2)From Approvers dashboard on edit form it will be landing in the step 1.1 only if the requester has clicked the checkbox  I do not know vendor name
    3)on click of next button It will skip step 1.2 if the requester has selected the checkbox product management approval is not required
    4)If the requester has not selected the checkbox product management approval we need to able to click step 1.2 and respective controls will be displayed 
     
    Note :For example in each controls we are specifying in the visible property respective step such as step=1 or etc so on 
     
    5)on click of next button we can continuously show the remaining step 2 till step 8 with no issues
     
    6)Finally,we have previous button which will be navigated based on the requestor checkbox such that we need to show or hide step 1.1 and step 1.2 respectively


     
     



     
     
     
     
     
  • WarrenBelz Profile Picture
    WarrenBelz 145,475 on at
    Navigation issues
    Hi
    Firstly I need to understand the "rules" you are applying for the various values - I have firstly condensed your code to this, so it is easier to apply the options
    Set(
       varReviewAndSubmit,
       true
    );
    With(
       {
          _Checked:
          First(colItemSetupSelectedRecord).'If item is in catalog or a drawing exists then Product approval is not required, Check the box',
          _Step: varStep
       },
       Set(
          varStep(
          If(
             _Step = 2 && !_Checked,
             1.1,
             (_Step = 2 && _Checked) || _Step = 1.1,
             1,
             _Step - 1
          )
       )
    )
    Can you firstly confirm if this works and also the values required for the various existing options for varStep.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard