cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
efroseroc
Helper II
Helper II

Setting Default values off hidden controls

Hello everyone,

This post is based on another issue solved with @WarrenBelz 

 

I'm trying to migrate some data from one sharepoint list to my power app based on a selected item in a ComboBox.

 

In my app I've created a form based on a list call LIST1, as now the list counts with 3500 records and is basically this:

The fields base, country, location and zone are Choice type.

The app is going to be used by users all around the globe who are going to fill purchases in it.

 IDDateSupplierAmount $Base LocationCountry Zone
1

31/03/2020

 

Ana

100

1st streetMUNGERMANYEUR
21/04/2020Pete502nd streetNYCUSANAM

 

I have another list called Suppliers, this list holds the Supplier info and is basically this:

The fields base, country, location and zone are Choice type as well.

ID

Name

BaseSLocationSCountrySZoneS
1Ana1st streetMUNGERMANYEUR
2Pete2nd streetNYCUSANAM

 

As you can tell is very similar to LIST1, so what I want is for the user to pick a supplier and that the fields (base,location,country,zone) are filled automatically and hidden from the user to save time and space. I'm adding a screenshot to help understanding.

For the suppliers ComboBox called Cbsuppliers I have:

   ITEMS: Sort(Suppliers;Name)

For the other ComboBoxes I have the same code but with the corresponding field, for example for Base the code is:

   ITEMS: Filter(Suppliers; Name = DDPROVEEDOR.Selected).BaseP

The error I´m getting is: This data type is not allowed for evaluation, data type Control.

 

 

 

Thanks in advance  for your help

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @efroseroc ,

Your issue is much clearer now you have posted the table content. Firstly, Name is not a good title for a field - it is a reserved word in PowerApps - you might consider changing it.

Starting with the hidden fields - example Location control Default

Lookup(
   Suppliers;
   Name = Cbsuppliers.Selected.Name;
   Location
)

OR

Lookup(
   Suppliers;
   Name = Cbsuppliers.Selected.Name
).Location

The same syntax will apply to Base, Country and Zone

I believe the drop down syntax for Base would be (depending on the Items property of DDPROVEEDOR)

Filter(
   Suppliers; 
   Name = DDPROVEEDOR.Selected.Name
).BaseP

 

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

 

View solution in original post

8 REPLIES 8
WarrenBelz
Super User III
Super User III

Hi @efroseroc ,

Your issue is much clearer now you have posted the table content. Firstly, Name is not a good title for a field - it is a reserved word in PowerApps - you might consider changing it.

Starting with the hidden fields - example Location control Default

Lookup(
   Suppliers;
   Name = Cbsuppliers.Selected.Name;
   Location
)

OR

Lookup(
   Suppliers;
   Name = Cbsuppliers.Selected.Name
).Location

The same syntax will apply to Base, Country and Zone

I believe the drop down syntax for Base would be (depending on the Items property of DDPROVEEDOR)

Filter(
   Suppliers; 
   Name = DDPROVEEDOR.Selected.Name
).BaseP

 

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

 

View solution in original post

Hi @WarrenBelz sorry for the late reply, I was doing some testing.

Thanks for your advice and overall help.

In concordance with your answer I have this code, as you know is basically the same for all so I just picked Base.

We are really close, but the issue is that the user still has to manually pick the Base and so on, even though there is only one option in the Cb.

The old field Name is now SupName.

Default: 

LookUp(
Suppliers;
SupName=Cbsuppliers.Selected.SupName
).BaseP

Items:

Filter(
Suppliers;
SupName=Cbsuppliers.Selected.SupName
).BaseP

 The Items Property of CbSuppliers is:

 

Sort(
Filter(
Suppliers;
Activity=true)
;SupName)

Activity is a Y/N field to know which suppliers are active.

Thanks again for your help.

Hi @efroseroc ,

Why have a combo box if there is only one choice? A text input connected to the relevant field can have the same Default and simply be reset when you need to populate it.

 

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

Hi @efroseroc ,

Did you get this sorted?

Hi @WarrenBelz, thank you so much for your interest,

I had some problems with my office account so I couldn`t work in the app for a while.

About the matter in hand, I tried with a list but since the Fields (Zone,Country and Location) are not text, but choice, I get an error message. 

Thank you for your help and understanding.

Hi @efroseroc,

What exactly is the error message and what code is it on?

Thank you @WarrenBelz the issue was that I inserted the code in the wrong place.

The correct way was, as you suggested

items:

LookUp(
Suppliers;
SupName=Cbsuppliers.Selected.SupName
).BaseP

 Thanks again and the best of luck!

Hi @efroseroc ,

You have accepted your own post as the solution - can you please consider correcting this.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (46,801)