cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Navigating only if in edit mode

Hello!

I am having a ticket system based on a gallery. 

This is how the gallery looks like:
https://gyazo.com/2065b4e1d96d485ae8208226f96d3d3e

This is how adding a new ticket looks like: 
https://gyazo.com/c28c70d616e33d63f19922f170ab76d0

Now whenever someone clicks on a ticket they get to see all of the information:
https://gyazo.com/cb516b93bfc705ac2632a26ab498abfe

Now whenever clicks on the edit icon they get the edit the information and save it. Now whenever someone is editing a ticket and wants to save it, I want them to be navigated to my screen (Overzicht) and whenever they make a new ticket, I want them to not navigate. How do I do this? Hope I explained everything well.

This is what I have tried already:

If(IsBlank(LookUp(MancoTabel, 'Ticket ID' = DataCardValue24.Text)), Navigate([@Overzicht]))

Every ticket has his own ticketID which is always unique. I have tried to do the code above^ but I need to have it check all the rows from mancotabel, ticketid except the last row, how do I do this?


1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Post Prodigy
Post Prodigy

Re: Navigating only if in edit mode

Fixed it myself doing the following code:

If(CountRows(Filter(MancoTabel, Value('Ticket ID')=Value(DataCardValue24.Text))) > 0,Navigate(Overzicht,None),SubmitForm(EditForm1));


If(CountRows(Filter(MancoTabel, Value('Ticket ID')=Value(DataCardValue24.Text))) > 0,SubmitForm(EditForm1),SubmitForm(EditForm1))

View solution in original post

16 REPLIES 16
Highlighted
Community Champion
Community Champion

Re: Navigating only if in edit mode

Put this on your SubmitButton:
SummitForm(YourFormName);If(YourFormName.Mode=FormMode.Edit,Navigate(Overzicht,None))

Try the code and give feedback. The other bit on TicketId is not clear

If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution
Highlighted
Post Prodigy
Post Prodigy

Re: Navigating only if in edit mode

@eka24 I will try the code tomorrow.

 

I will explain the ticket ID with more details.

Whenever you create a ticket, it will have his own ticketid. This will always be lastticketid+1. So the ticket ID will always be a unique number. Now what I was trying to do; 

I would check if there was a ticketid with the ticket id that would be submitted/editted. If the ticketid would be in that row already it would navigate me back to browsegallery. If the ticketid is not in there yet, I want them to stay on that screen and not navigate to another screen.

Code I tried:

If(IsBlank(LookUp(MancoTabel, 'Ticket ID' = DataCardValue24.Text)), Navigate([@Overzicht]))

This basically checks if the ticket id is already in the column  ticket id, if it is, it will navigate to overzicht. But now even if you add one it will check after submitting. So I basically want this code to check all the rows in ticket id except the last row. 

Highlighted
Community Champion
Community Champion

Re: Navigating only if in edit mode

Have tried it:
If(CountRows(Filter(MancoTabel, 'Ticket ID'=DataCardValue24.Text)) > 0,Navigate(Overzicht,None),SubmitForm(Form2))

 

Explanation:

If the Number or text entered into DataCardValue24.Text is already in the Ticket ID Column in MancoTabel,
then Navigate to Overzicht otherwise Submit the form and stay on the current screen.
You can manupulate it to whatever you want, but the formula works.
The only thing I would add is that if Ticket ID is a number Field, then it should be:
If(CountRows(Filter(MancoTabel, 'Ticket ID'=Value(DataCardValue24.Text))) > 0,Navigate(Overzicht,None),SubmitForm(Form2))

 

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Highlighted
Post Prodigy
Post Prodigy

Re: Navigating only if in edit mode

Hello @eka24 ,

I've tried it your way but I then get an error. I have put the code inside of the OnSelect of the Check icon to submit the form. 

https://gyazo.com/bb76e3b58b5dc68c28c3b4f722f9ae35 What am I doing wrong? I also have another question, where did you get the form2 from?

Highlighted
Community Champion
Community Champion

Re: Navigating only if in edit mode

The form2 is just a name I used to represent your form. So change it to your Actual form name you are submitting, in your case EditForm1.
Please try the first formula and give me feedback

Highlighted
Post Prodigy
Post Prodigy

Re: Navigating only if in edit mode

I have tried that already. This is the code I tried: https://gyazo.com/bb76e3b58b5dc68c28c3b4f722f9ae35

And this is what the error is: https://gyazo.com/788a4b470d80dbc42654d58082afc4f3

@eka24 

Highlighted
Community Champion
Community Champion

Re: Navigating only if in edit mode

When you hover your cursor around the blue icon under the = , what does it say?

I suspect the issue may be comparing text column with number field

Before you reply try this wraping value around the Ticket ID :
If(CountRows(Filter(MancoTabel, Value('Ticket ID')=Value(DataCardValue24.Text))) > 0,Navigate(Overzicht,None),SubmitForm(Form2))

Highlighted
Post Prodigy
Post Prodigy

Re: Navigating only if in edit mode

It said:

"Incompatible type. We can't evaluate your formula because the values being compared in the formula aren't the same type."

However, the last code that you sent worked for me but, I always get navigated to the overzicht. Even when the ticket id is not in there. Thats why I need it to check all the rows except the last one, cause I think it submits before it checks if they ticket id is in that column.

@eka24 

Highlighted
Community Champion
Community Champion

Re: Navigating only if in edit mode

I have spent some time on this formula and tested it works as it is.
The issue is comparison of this: 'Ticket ID'=DataCardValue24.Text
Is 'Ticket ID' a textfield in your datasource or number field?
Is DataCardValue24.Text formatted as a textfield or number field in your powerapps EditForm1?
Knowing this would help a workaround to achieve the objective, either using Trim or Value function to work it around.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,881)