When a user is typing in a url in a text field within the OnPreviousNextClick in an assign i want to add "https://" to a url that does not contain it ( www.test.com) but if the url is (https://www.test.com) do nothing and leave it as is.
If(Index(URL,"https://") <> -1,URL, "https://" + URL) i have this just now which works for if URL doesn't contain but if i have (https://www.test.com) it makes it https://https://www.test.com
Hello Tahm Kench 😄,
I tried it on my side, and it’s working based on your condition. There’s one scenario I’m not 100% sure about: if you click the button more than once, https://www.test.com could become https://https://www.test.com. This isn’t caused by the condition itself, but by the click trigger firing multiple times.
So when it reaches the condition, it sees https://https://www.test.com. The index is not -1, so it evaluates as true but the extra https:// wasn’t added by the condition itself; it’s already there from multiple clicks.
Another scenario is that it’s very case-sensitive. For example, if you forget to include a trailing /, it may behave differently and be automatically added.
Hello.
That expression should work.
If(Index(URL,"https://") = 0, URL, "https://" + URL) is even better as it always looks at the very start.
Can you share the flow? The error is probably somewhere else.
Firstly, your condition is correct, nothing to change. I wanna know whether the URL is the variable binding to the input or it is the other one.
Its safe to let result = your if statement with the input variable, which means 2 variables. Then it won't double add the https:// to the same variable
@Nuno Reis is correct that index = 0 means "start with", it is best condition for your case
@Shingo Lam
I don't understand this. Why would assigning URL instead of some other variable cause the double
Hi @Dorine Boudry ,
As I mentioned, its safe. My recommendation is to avoid the double assignment to the same variable, so use 1 separate variable for result can eliminate the programming mistake like that
Hi @Calum Rogers ,
I think you need to share that code flow because the conditional statement you're using is correct. However, you might have some incorrect assignments around it.