1
votes

I got a gallery with Title and Subtitle, data source is from SharePoint List.
Title:

ThisItem.name_check_list

Subtitle:

ThisItem.user_mail

My example item Title is: CQ 00.11/22, and my Subtitle is: [email protected]

When i use button with OnSelect action:

Select(Parent);
If(ThisItem.user_mail = "[email protected]", Navigate(BrowseScreen1, ScreenTransition.None), false)

Everything is ok, it navigates me to BrowseScreen1.
But when i use button with OnSelect:

Select(Parent);
If(ThisItem.name_check_list = "CQ 00.11/22", Navigate(BrowseScreen1, ScreenTransition.None), false)

It returns false and i have no idea what I am doing wrong. I tried use Gallery1.Selected.name_check_list instead of ThisItem but without result.

Screenshots of my app:

screenshot of app with tree view

data source of gallery

Screenshot with Title2.Text = "CQ 11.12/39": enter image description here

2
Is the button where you have the OnSelect expression inside or outside the gallery? Can you post a screenshot of your app, including the tree view of the controls (on the left side of the canvas) - redacting any sensitive information that you don't want to share?carlosfigueira
Button is inside the gallery, screenshots added in my question.aozk
I tried recreating the same scenario (which you can donwload from carlosfigueira.blob.core.windows.net/public/…), and the navigation worked out fine. Is it possible that the data that you have has leading or trailing spaces, which would cause the comparison to fail? If this is the case, you can try using something like If(Trim(ThisItem.name_check_list) = "CQ 00.11/22", Navigate(...carlosfigueira
I used Trim() and it worked. Thanks!aozk
Glad to hear. I've posted this as an answer, so that if other people stumble this same problem they should find it.carlosfigueira

2 Answers

1
votes

Based on the comments in the question, you have leading and/or trailing spaces in the values in your list, which is causing the If condition to be evaluated to false.

You can use the Trim function to remove those spaces, and with that the expression should start working:

If(
    Trim(ThisItem.name_check_list) = "CQ 00.11/22",
    Navigate(BrowseScreen1, ScreenTransition.None))
1
votes

Here is what I changed in your example:

Select(Parent);
If(name_check_list.Text = "CQ 00.11/22", Navigate(BrowseScreen1, ScreenTransition.None), false)

Try adding ".Text" to the comparison if that will do it.