cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Unexpected boolean behaviour

Hi Power People

 

I have a Gallery displaying a SharePoint List and a TextInput control serving as a search box for this Gallery.

 

For privacy reasons, only a single item being searched for, should be displayed in the Gallery.

 

I have attempted to address this requirement by covering the Gallery with an opaque Rectangle. Only when the TextInput search box has more than 3 characters, will the Rectangle disappear, revealing the whole Gallery, which should now only contain a single item. Here is the code on the Rectangle's OnVisible property.

 

 

If(Len(TextInput.Text) < 3, true, false)

 

 

This works great! Until it unexpectedly doesn't, albeit only briefly. Infrequently, the Rectangle is invisible, even though the TextInput field is empty (<3 characters)

 

How is this possible?

 

===================================

 

A little more background (optional)

 

If you want, do reference an old post I made trying to find a solution to this requirement here, which I thought I resolved. The simple boolean above also has a Timer control which I omitted for brevity. This is another measure I employed, by delaying when the rectangle disappears.

 

 

If(Len(TextInput.Text) < 3, true, 
If(Timer.Value = 0, true, !varDelayOutputTimerUp))

 

 

As a final measure, I have added 10 dummy entries into the list, and am sorting this list by Title. So even if the Rectangle is invisible when it shouldn't be, only information that is not sensitive is shown. However, I have seen at least once so far, where I have entered two characters, and the rectangle disappears, again how is this possible?

 

Another idea I had was to use checks to see how many items is in the list when the search is complete, if more than one item is in the list, the the rectangle will remain visible. Here is the code I thought of using

 

 

If(Gallery.AllItemsCount > 1, true false)

 

 

I feel like I'm overcomplicating things again.

 

Any thoughts appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks for explanation @fnanfne but I am still not "getting it".

 

The basic Filter expression I provided above will only display records in the Gallery as long as an absolute match is returned. With this simple solution, there is no need for masking the Gallery with rectangles or anything else.

 

However, I appreciate there is more to this than I understand, and I hope you find a solution.

 

Visual example below:

 

examplefilter.gif

 


------------------------------------------------------------------------------------------------------------------------------


If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

If you like my response, please give it a Thumbs Up.

Imran-Ami Khan

View solution in original post

11 REPLIES 11
Amik
Super User
Super User

Hi @fnanfne ,

 

It might be worth taking a step back and talking about the requirement instead of the solution.

 

I understand there are privacy concerns and that users should only see a single item based on the entered code. But why use a search function like StartsWith? If users do not know what the unique code is and need to search for it, then logic would indicate that users would need to see different codes in order to identify the right one they need?

 

If users do know what the code they want to see is, then using a Filter function on the Gallery against the search box (rather than a  StartsWith function) should suffice?  

 

------------------------------------------------------------------------------------------------------------------------------

 

If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

If you like my response, please give it a Thumbs Up.

 


------------------------------------------------------------------------------------------------------------------------------


If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

If you like my response, please give it a Thumbs Up.

Imran-Ami Khan

Hi Amik

 

Thanks for the reply.

 

Without going into too much detail, a user might share their screen with external parties while using the app. These external parties should only be able to see their own data, no one else's. All users know the three letter code, if they don't or are unsure, I have placed a convenient button named "Email Items List", which when clicked, will send the user an email with the full list. They can then reference this list from their email client, hopefully on another screen, not seen by the external party, and look for the exact code they want to use. Then return to the App and enter that code.

 

Here is the code on the Items property of the Gallery

Sort(Filter([@'SharePoint List'], StartsWith(three_letter_code, Upper(TextInput.Text))), Title, SortOrder.Ascending)

 

Is there another way to address this requirement then? Instead of StartsWith, what can I use?

@fnanfne 

 

you can achieve your requirement by using queryparameter

 

for this you need to pass values in url ex: powerapplink?screen=screen1&guid=fa0f3d4e-95dc-4352-aab0-c0ed5d0882ae

 

goto app startscreen property:Switch(Lower( Param("screen")),"screen1",firstScreen,"screen2",SecondScreen);

 

similarly on respective screen you can use Param("guid") to get the unique value and get the required result for you

 

you can above reference powerapplink?screen=screen1&code=abc

 

using the above code Param("code")

 

Sort(Filter([@'SharePoint List'], StartsWith(three_letter_code, param("code"))), Title, SortOrder.Ascending)

 

or on screen start store code in a variable

 

Please click Accept as solution and Thumbs Up. 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 Thumbs Up.

Please click Accept as solution and give it Thumbs Up 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 Thumbs Up.
Connect with me on Linkedin : DeveloperAJ

Thanks for clarifying @fnanfne.

 

Why does using a Filter function on the Items property of the Gallery not solve this requirement?

 

Filter(
    'Your Data',
    three_letter_code = TextInput1.Text
)

 

------------------------------------------------------------------------------------------------------------------------------

 

If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

If you like my response, please give it a Thumbs Up.

 


------------------------------------------------------------------------------------------------------------------------------


If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

If you like my response, please give it a Thumbs Up.

Imran-Ami Khan

Hi @developerAJ

 

This "queryparameter" is new to me, thanks for sharing. I'll play around with that and see if it works for my scenario.

 

Hey @Amik

 

I tested but that is not going to address my requirement. Here's some pics to illustrate the problem

 

This is the screen the user lands on (having navigated here from another screen) Note the amount of items in the Gallery.

I've added some labels (only visible to me) showing how many items are in the gallery, and the status of the variable responsible for initiating a timer control, making the rectangle disappear.

 

powerapp_search_1.png

 

This is what happens when one character is entered into the search box. Note the amount of items now in the Gallery, and the fact that the Rectangle is still visible (covering the Gallery)

 

powerapp_search_2.png

 

Now, a second character is entered in the search box. Again, note the number of items in the Gallery at this point, and also the Rectangle is still visible.

 

powerapp_search_3.png

 

Now, the final character is entered, collapsing the entire List/Gallery into a single item, and also, after a 500ms delay, making the Rectangle invisible, finally exposing the Gallery with the single item shown, ready to be selected.

 

powerapp_search_4.png

 

This all works great, as per the pictures above, however, sometimes, the Rectangle is not visible, when it should be, as per the pic below.

 

powerapp_search_5.png

 

As you can see, this is not the expected behaviour. The search box has zero characters, and so the rectangle should be visible, but it ain't!

 

How is it possible, that the boolean on the Rectangle is seemingly ignored, albeit only very briefly, and only very sporadically?

 

Are there some "order of operations" that I am unaware of? Do Booleans load last?

 

This is what happens when I use your code in the Items property of the Gallery. It shows ALL items in the gallery after one character is entered, not what I want.

 

powerapp_search_6.png

 

I was thinking of changing the Visible property of the Rectangle to include yet another check, like this...

 

 

 

If(Len(TextInput.Text) < 3, true, 
If(Timer.Value = 0, true, 
If(Gallery.AllItemsCount > 1, true, !varDelayOutputTimerUp)))

 

 

 

This again works, but I'm still perplexed as to why I'm seeing this unexpected boolean behaviour.

 

This should work with only the first check in place (If(Len(TextInput.Text) < 3), true, false) but it doesn't, again, only sometimes.

@fnanfne 

 

Thats strange 

There is a property for textinput control delayoutput but it does not delay by long may be a second it its true.

 

Anyway if it does not get fixed may be you can use the same formula you are using in gallery.Items. so that your gallery and rectangle will be in sync

 

just do the countrows(). if its not equal to1 make rectangle visible. so if gallery has more than one item rectangle will appear 

or remove startswith and use =

Sort(Filter([@'SharePoint Items List'], item_code=Upper(TextInput1.Text)), Title, SortOrder.Ascending)

 

Please click Accept as solution and Thumbs Up. 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 Thumbs Up.

Please click Accept as solution and give it Thumbs Up 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 Thumbs Up.
Connect with me on Linkedin : DeveloperAJ

Thank you both!

 

Although this problem is still up in the air, kind of, I am happy with your suggestions.

 

I removed the StartsWith, and the code still works as expected, pending further use of course, but this might have caused the issue, let's see.

 

Further, I have now added the same code to the Items property of the Gallery.

 

I'll see how this behaves over the next few days and report back.

Thanks for explanation @fnanfne but I am still not "getting it".

 

The basic Filter expression I provided above will only display records in the Gallery as long as an absolute match is returned. With this simple solution, there is no need for masking the Gallery with rectangles or anything else.

 

However, I appreciate there is more to this than I understand, and I hope you find a solution.

 

Visual example below:

 

examplefilter.gif

 


------------------------------------------------------------------------------------------------------------------------------


If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

If you like my response, please give it a Thumbs Up.

Imran-Ami Khan

I don't know what I did before, but when I tried your code again just now, it works like above!

 

I have turned the rectangle off and only one result is shown which is just what I want. Looks like this is the best way to scratch the cat, and most efficient. No more boolean checks, and I can also delete the redundant dummy entries. Thanks again to you both, appreciated!

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,500)