cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mbeard
Frequent Visitor

Finding the attribute the control is bound to

Can this be done? 

 

I'm in debug, looking at "this" which is a type of my control but I can't see any obvious property that would tell me the attribute I'm currently bound to.

 

Has anyone come across this?

1 ACCEPTED SOLUTION

Accepted Solutions

Currently the address fields have issue configuring to the custom components and you will hit this. This was blocked by composite control team I beleive as address was one composite control in legacy interface. We are evaluating to make this consistent.

 

For your scenario, you can create custom fields on the entity for address components like street, city etc. Write the client API to populate these fields from any address 1,2,3 user chooses and bind these to the custom component. 

 

I build one using azure cognitive to autofill address (control bound to just one dummy field) and as user types dropwon is populaed based on the search results from azure. On user selection fields are populaed back to the individual address fields (custom again as OOB address fields cannot be configured to components)..

 

Let me know if you need to see that code 🙂

View solution in original post

5 REPLIES 5
HemantG
Power Apps
Power Apps

When the control is bound to any field it only has the contract of attribute type and value. Adding any special handling inside control implmentaton means that control is not generically reuseable/configurable anymore.
If there is a special case you can use WebAPI/Utility methods. Ideally controls should use just utilize  context.parameters.controlValue.* where conrolValue is declared manifest property.
 
What scenario you are trying to acheive ? 
mbeard
Frequent Visitor

Making an address control - except people could have multiple addresses. So I’d like to dynamically allow a user to selected an address and it populates the relevant address based on which line1 was typed into.

Ideally I didn’t want to make a user manually select all address fields during configuration

Currently the address fields have issue configuring to the custom components and you will hit this. This was blocked by composite control team I beleive as address was one composite control in legacy interface. We are evaluating to make this consistent.

 

For your scenario, you can create custom fields on the entity for address components like street, city etc. Write the client API to populate these fields from any address 1,2,3 user chooses and bind these to the custom component. 

 

I build one using azure cognitive to autofill address (control bound to just one dummy field) and as user types dropwon is populaed based on the search results from azure. On user selection fields are populaed back to the individual address fields (custom again as OOB address fields cannot be configured to components)..

 

Let me know if you need to see that code 🙂

View solution in original post

mbeard
Frequent Visitor

I can still bind to individual address fields, do you foresee that being a problem?

 

I've just made a input property like this:

of-type="SingleLine.Text" usage="input"

and will ask users to manually type in the field they are binding too for now. Not the end of the world.

 

Thanks.

Manually typing in the field is not something which is supported. I havent tried this but you might run into issues saving back the values to those fields. Probably creating a shadow field and using the PBL or client API is the best bet. 

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

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

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Users online (25,597)