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

Resetting a Combo Box so I can add a new record

I have a stand alone PowerApps form; I am not using the out of the box form; just controls.  


I'm having trouble resetting the a combo box so I can add a new record.   

Below is my formula which gives me the error "Expected Record Value".

My variables are working correctly on what I see in my "watch" labels and the action is behaving correctly on a text input field -- so the issue is not the variables working correctly. 

If(varNewRecord,"",LookUp(Gallery1.AllItems,ID = varChapterSelectedID,'cmbxClassification Record'.Selected.Title))

Thanks, in advance, for your help! 

7 REPLIES 7
RandyHayes
Super User
Super User

@CindyZ 

Can you indicate which property on the combobox you are trying to set - Items or DefaultSelectedItems?

Either one requires a record.  You are trying to assign a Text - which will give you the error you are showing.

I am not clear on your problem if you are trying to set the items or the default, could you clarify?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Yes, Randy.  I'm sorry I left that out. I'm trying to reset "Default" since I have limited the  input to only 1 item. 

RandyHayes
Super User
Super User

@CindyZ 

So you mentioned this is a Combobox - The Default property on a combobox does nothing.  You will need to set the DefaultSelectedItems property to get your selections properly.  And, it needs to be a record that corresponds to the records in the Items property of the combobox.

If you can provide a little more context on your app and what the Items property is for that combobox, then perhaps I can shed some more light on it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you Randy, 

 

1. One Combo box has this in the items property - ["Global", "Local"] and that is the one that has the formula noted above. Would doing that as a drop down work better?   
2. The other combo box has this in the items property - Classification which is a lookup into a collection.  I have not yet tried to add anything to the default items property since I felt sure I'd hit the same or a similar wall as the above. 

CindyZ_1-1608155189654.png

 

 

What I'm trying to do is clear these combo boxes so I can enter a new record.  Here is the formula for the "add record" on Select. 

Also, here is my Patch Statement. 

Set(varChapterSelectedID,

Patch('B-E-RG Organizations',

{ID:If(varNewRecord, Blank(),varChapterSelectedID)},

{'Chapter Name': txtinputChapterName.Text,
IsLocalChapter:cmbxLocalChapter.Selected.Value,
Classification:'cmbxClassification Record'.Selected.Title,
BERG:cmbxBERG.Selected.Title,
'ID-ERG':lblBerglblInput.Text,
Acronymn:lblAcronynmInput.Text,
LocationNameOrg:cmbxLocationNameInput.Selected.Location_x0020_Name,
PrimaryAddress1:lblPrimaryAddress1Input.Text,
PrimaryAddress2:lblPrimaryAddress2Input.Text,
PrimaryAddress3:lblPrimaryAddres3Input.Text,
PrimaryAddressCity:lblCityInput.Text,
PrimaryStateProvince:lblStateProvinceInput.Text,
PrimaryCountry:lblCountryInput.Text,
ZipORPostalCode:lblZipPostalInput.Text,
LocationType:lblLocationTypeInput.Text,
Level1:lblLevel1Input.Text,
Level2:lblLevel2Input.Text,
Level3:lblLevel3Input.Text,
Level4:lblLevel4Input.Text,
Level5:lblLevel5Input.Text,
ConcatenatedChapterName:lblConcatenatedChapterName.Text}).ID);

UpdateContext({varEditing:false,varNewRecord:false})

 

Even though my Patch formula does not show any errors, I just now saw that it is giving me this message...

CindyZ_0-1608155042563.png

 

Finally, I am following along using PowerApps 101: Create your own forms – Giacomo Baizini's business IT blog (baizini-it.com) which was working great until I hit these combo boxes. 

 

Hope this was not too much and that it is helpful. 

 

Cindy 
"

 

RandyHayes
Super User
Super User

@CindyZ 

I'm starting to dig into what you sent, but I have one particular question, is there any particular reason for building this with your own controls over using the built in EditForms?  It would be much easier for you as you would not need these long Patch statements.  This is more of a curiosity question.

 

As for your #1 question - Yes, you only have two items in your Combobox.  This would be easier to handle if that was a DropDown.  Comboboxes bring the ability to search and to multi-select.  If you do not need those capabilities on that control, then always favor a Dropdown rather than the combobox.

 

As for #2 - I believe I am close on what you are doing, but need some clarification...you mention that the Items property is based on a Collection - what is that collection and how is it defined?  But, I look at your original formula you posted and see you are Looking up some value in Gallery1 - how does that fit into what you are doing.  I am not seeing the connection for that yet.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
CindyZ
Post Prodigy
Post Prodigy

First of all, Randy, thanks so much for your kindness to help and the manner in which you ask your questions.  I'll try to answer them as best I can. 

 

Why did I go the route of Patch.  First of all, a co-worker looked at an app I'd built one time and commented on the number of calls I was making and said it was slowing my app down. My app does include a number of SharePoint lists that cannot be in a single list.  He said, prior, I should be using Patch -- which I was terrified of.  He is someone whose work I respect and he has built a number of apps.

 

I have wondered, throughout this process, why so many of the blogger and community leaders have used forms instead of standalone controls while I'm stumbling around here --- but I will say I've enjoyed learning Patch and using it and I do like the flexibility. 

 

I do not like the room the out of the box forms take even if I do adjust them but I can live with that if that is the best route to go.

 

Also, another reason is that another tutorial I had been working with/following along on this project also used Patch.  But, really, the only true reason was I was guided to use Patch over Submit was because that is the direction in which I was led from multiple fronts.    So, there is that answer. 

 

I'd also like to say here your question and my reply points to a tremendous gap in learning/knowledge that is available -- the ability to understand the approach to and the why of particular situations.  I have read plenty on Patch versus Submit and get very divided opinions.  Another current question I have is: This particular solution I'm working on has a number of different but related forms and every day I wonder -- should I make it one app or make it several apps.  I still don't know the answer.  The lack of guidance on strategy and the lack of complete solutions from start to finish I find baffling since we're out there on our own to piece so much together if we want/need to do anything complex. 

Frankly, Microsoft promotes how easy PowerApps is to use that sometimes we don't even know we're into a complex app until we're far down the road already. The comprehension of learning materials and the knowledge also, of course, change with the education and experience of the user.  We are in the process of hiring some assistance for me for those times I hit a wall. And I do appreciate the simplicity of PowerApps in some situations but, it does not work in so many of the situations I face. 

 

So, there ya go - probably didn't anticipate that can of worms, huh! 

 

I'd not even thought of using a drop down on that first item until I replied back to you -- I was focused on the dilemma I suddenly faced with four combo boxes that I'd frankly not expected to run into.  I do need multiple choice selection  and search in the other combo boxes which is the reason I chose those. 

 

I'm not sure what you mean on the definition of my collection.  But, in this case it is a simple one column collection that I load along with others.  I'm sure this one does not need to be a collection but my other  collections do since they are multi column with a large number of choices/records (facilities for examples).  

 

The gallery I refer to is simply a gallery view of the records I'm creating and submitting. I am using that to search and select the record I want to update or modify.  Unless I'm far off base, that seems to work fine in interaction with my form.

Thanks again !   




 

RandyHayes
Super User
Super User

@CindyZ 

Yep...here it is.  It was only 4 tabs deep in my list of catch up work.

 

So yes, Patch has its place, but if you have an easier method (i.e. the form) then go for simple!  Patch patches records together.  Interestingly enough I don't see many conceptually using it for that purpose it was intended for, but rather "it is how you write stuff to a datasource".  Anyway, that's a side story.

 

I would recommend watching my comprehensive video on Forms that will tell you everything you ever wanted to know about them and things you might have never imagined you could do with them.  It will show you how to really make a form look exactly like you want and how to even separate out the power of the EditForm from the visual of the form (which is, as you say, kind of ugly with the spacing).  It's a long video, but there is a table of contents to get to key parts of interest.

 

Also, everyone uses collections and variables - avoid them at all costs!! (not to say they don't have their place, but people overuse them and, there is where you start dealing with complicated app formulas, issues with data, and just a royal pain to deal with).  Keep this in mind...a datasource IS a collection!  So, unless there is a compelling reason to use a collection, leave it in your toolbox for when it is really necessary.  We have tons of complex apps and in most you will find no collections and very few (if any) variables.  They are not needed and even the PowerApps docs warn you to not use unless really needed - and take my word, there are times when they are needed.  BUT, you will find tons of "learning" stuff out there - I find a good 80-90% is really poor advice.  Most talk about a variable for this or a collection for that, timers to do something that is already automatic, ForAll used as a loop to create a collection in a collection from a collection...etc, etc...I could rattle on. Most represent the presenter has not mastered the platform. This is why I've devoted time to do videos that are all about the REAL simplicity of PowerApps and how to nail an app in as little time as possible with the smallest amount of formulas etc.  I will give a hint - Think Excel!!!  Anyway, it is just an issue of finding time to do the videos.  And...I'm not trying to puff myself up, just stating that the ways people go about things is just so very wrong and complex, when the solution is so simple.

 

As for strategy - Yes, there are ALWAYS design choices you have to make.  In regard to the multiple forms vs multiple apps, I balance it between two things:

1) Do I have the same functionality that I would have to duplicate in the apps?  If so, then one app as you don't ever want to have to deal with a formula more than once...that means even - NO copy/paste of MEANINGFUL formulas ever! (highly simple formulas for things like positioning, etc. are okay)

2) Does the impact of multiple datasources play a role in performance in some way that I can't block it?  If so, then multiple apps, if not, then one app and block.

 

Actually Microsoft does promote the simplicity of PowerApps, but they provide sample templates and guidance that is *poorly* done to really emphasize the simplicity.  AND many people are coming to PowerApps with a developer mindset...PowerApps is NOT development!  The more developer you are, the more trouble you will have.  You have to drop the hat at the door.  Again...think Excel!!  It's all about formulas!  PowerApps is best suited for Excel Power Users (not people that make worksheets look pretty, but people that can crank out a formula in a cell like it is nothing).

 

So...tasty can of worms opened! 😉

 

Now, back to the story!

Yes, this is why, as I read through your original post and reply, I wondered why not just use an EditForm where all of this is done for you so easily.  

As for the collections, I would say get rid of them as much as you can, you don't need them in the way.  I was referring more to whatever the collection was that you had on the Items property.  What is it?  What formula defines it?

As for the other collection, again, consider dropping the collection - what is the formula for that one?  You seem to indicate it is complex...explain more on that.

Now for the Gallery...yes, very basic.  
So the reality is, a simple Gallery like you have can feed an EditForm completely with what it needs and all the Patch work is eliminated that you are doing and we can certainly incorporate the dropdowns into the form (in fact, the form will do that for you in most cases - watch the video).

 

So, first, sorry for the delay in response and let me know what your thoughts are.  If you any questions...bounce them at me.  

And - happy holidays!

 

 

 

 

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!     Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!     Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!     UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!     European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!   Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!   For more events, click the image below to visit the Microsoft Community Days website.    

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip: Community User Groups

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: Community User Groups and YOU Being part of, starting, or leading a User Group can have many great benefits for our community members who want to learn, share, and connect with others who are interested in the Microsoft Power Platform and the low-code revolution.   When you are part of a User Group, you discover amazing connections, learn incredible things, and build your skills. Some User Groups work in the virtual space, but many meet in physical locations, meaning you have several options when it comes to building community with people who are learning and growing together!   Some of the benefits of our Community User Groups are: Network with like-minded peers and product experts, and get in front of potential employers and clients.Learn from industry experts and influencers and make your own solutions more successful.Access exclusive community space, resources, tools, and support from Microsoft.Collaborate on projects, share best practices, and empower each other. These are just a few of the reasons why our community members love their User Groups. Don't wait. Get involved with (or maybe even start) a User Group today--just follow the tips below to get started.For current or new User Group leaders, all the information you need is here: User Group Leader Get Started GuideOnce you've kicked off your User Group, find the resources you need:  Community User Group ExperienceHave questions about our Community User Groups? Let us know! We are here to help you!

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!  

Top Solution Authors
Top Kudoed Authors
Users online (7,036)