Hello Everyone,
I am creating a power app using SharePoint list and I have two shares point lists:
Profit_center_index
Profit_cent_id,
Profit_cent_name - Display in the first data card
Busineessunits_index
bu_profit_cent_id
bu_id,
bu_name - Display in the second data card
The first data card (Combobox) allows the user to select the profit center name and base on the selection Profit_cent_id must store as a value/variable to filter the second data card.
In the second data card bu_profit_cent_id = Profit_cent_id will be mapped and all the bu_name which are matching must be displayed on combobox.
To store profit_cent_id as the value I have done a couple of tests:
Filter in businessunits data card (items) but I got error near = sign
Error:
incompatible type for comparison. These types can't be compared: Number, Table
Filter(
businessunits_index,
bu_profit_cent_id = profitcenter_index.profit_cent_id
).bu_name
The second option I used with the first data card onchange option
Set(pid,
Filter(
profitcenter_index,
proft_cent_name = DataCardValue2.Selected.proft_cent_name
).profit_cent_id
)
Error:
incompatible type for comparison. These types can't be compared: Number, Table
In both above options, I am getting the same error
So can I know where is the problem and what I am doing wrong?
Thanks,
Solved! Go to Solution.
Hi @tusharmehta ,
Ok, so just to make sure I understand - you're saying your Sharepoint column types for profit_cent_name and businessunits_name in the ledger_ac_transaction list are already Lookup column types to those lists?
If so, then filtering the comboBoxes with the sources directly disregards the lookup function of the SharePoint Column - which is why trying to save a result from that is blank.
My opinion: When it comes to building Power Apps from SharePoint lists, lookup columns are just headaches waiting to happen, so always go for simple column types and rely on Power Apps to control the user experience. If you're stuck with them however, then hopefully this still helps you.
I should add, that unless you actually need the columns to be lookup columns in SharePoint, you can make your life a whole lot easier by removing them and instead recreating these two columns to be plain text columns. It will save you a lot of headaches. If for some reason you absolutely need them to be lookups, then forge ahead. I'll answer in two parts - one for lookup columns, one for plain text columns.
I'd also suggest, before you continue, that you create a new form so we can start everything again from default and not have to worry about previous changes.
#Part1: Keeping your lookup columns
So, if we're using lookup columns, we must use the results of a Choices() function to ensure what we save back to SharePoint matches up with what SharePoint expects for that column type. This is why our Filter() function direct on the source is coming up Blank when we submit it. It's not the bu_name we need to store, it's actually a reference to a record (usually just the ID of the record) that contains the value and SharePoint is just displaying the value from a specific column in that record based on your column configuration. The Choices() function allows us to pick a record from a list and the control ensures the correct reference is stored back in SharePoint. Therefore, we're stuck with it.
It is possible however to Filter those choices - but if our filter depends on another column, (like profit_cent_id), then this is a problem. By default the Choices() from a lookup column only contain the actual column values, not the entire record - meaning profit_cent_id is not available to us to go perform filters on. Initially, our Choices() table coming from
Choices([@ledger_ac_transaction].businessunits_name)
looks like this;
We want to filter that based on the profit_cent_id associated with each bu - but it's not there for us to filter. Luckily, if our bu_names are unique, we can use these values to go and fetch their corresponding profit_center_id values using AddColumns() and our own LookUp() function in PowerApps.
This is very inefficient, as not only is SharePoint fetching the choices initially, but we're now also performing our own lookup for each Value to the same source list which makes every call redundant - so - highly inefficient, but doable.
So first, let's look at how we add the columns we need [just for reading, you don't need to set this anywhere just yet];
AddColumns(
Choices([@ledger_ac_transaction].businessunits_name),
"pc_id", LookUp(businessunits_index, bu_name = Value, profit_center_id)
)
This should give us the following list for our bu_name Combo box
Note: This will only work properly if your bu_names are unique in businessunits_index list.
Now that we have some way to filter our choices, we can wrap the above function in a Filter function. Set the buCombo Items: property to this;
Filter(
AddColumns(
Choices([@ledger_ac_transaction].businessunits_name),
"pc_id", LookUp(businessunits_index, bu_name = Value, profit_center_id)
),
pc_id = pcCombo.Selected.ID
)
If you created a new form like I suggested up front, then the defaults for the card Update: property should remain. Now if you submit the form, it should work?
#OPTIONAL Part2: using plain text columns
If you'd like to clean things up a bit, and if you expect people to only use your Power App to capture data into your list, you may want to use plain text columns to store the data instead of lookup columns.
You can't convert lookup columns, so you have to create new columns to hold the data.
To be safe, I'd rather add two plain text columns with slightly different names, and once everything is working fine and you're happy with the results, then you can remove the lookup columns...so for now, let's assume your ledger_ac_transaction list now has two additional columns that are plain text - pc_textname and bu_textname.
With the new columns added, refresh your ledger_ac_transaction source in PowerApps by selecting data sources and then clicking the ... menu next to ledger_ac_transaction and click Refresh.
Then, add an Edit form, connect it to ledger_ac_transaction and set it's default mode to New.
Because they are plain text columns, the pc_textname and bu_textname DataCards will default to Text Input controls, and the card's Update: property will point to each Text Input's .Text output by default. There are few ways to change this to suit our combo needs, but I'll opt for the cleanest - which means removing the Text Inputs, adding Combo's and changing the DataCard Update: values to point to the Combo's instead.
pc_textname DataCard
Select the Card, right click and select "Unlock"
Select the Text Input and copy it's name - we're going to reuse it
Delete the Text Input - ignore any errors for now. Insert > Input > Combo box.
Ignore the "Select Data Source" popup and edit the Items: property in the formula bar to;
profit_center_index
Rename the ComboBox and paste the name of the TextInput (it should be something like DataCardValue with a number eg: DataCardValue23). For reference in my formula here I'm going to use "pcCombo" as the name, just so it's easier to reference - wherever you see pcCombo in my formula just replace it with the control name you copied for the profit center combo box.
In the advanced properties of pcCombo, set the following fields;
Select the data card, set the Update: property to;
pcCombo.Selected.profit_cent_name
If you copied the original name of the Text Input and renamed the combo then you shouldn't see any other errors.
If you still see errors on the card, they are likely references to the TextInput control that was there. For example, the error text usually hangs underneath the Text Input with a Y: property of DataCardValueNumber.Y + DataCardValueNumber.Height. If your text input is gone and your combo isn't called DataCardValueNumber, then you'll get errors.
To fix these, either go and update the reference DataCardValueNumber to whatever you called your combo, or just name combo DataCardValueNumber and the errors will be fixed.
bu_textname DataCard
Select the Card, right click and select "Unlock"
Select the Text Input, copy it's name, then delete the control - ignore any errors for now.
Insert > Input > Combo box.
Ignore the "Select Data Source" popup and edit the Items: property in the formula bar to;
Filter(
businessunits_index,
bu_profit_cent_id = pcCombo.Selected.profit_cent_id
)
Rename the ComboBox and paste in your copied name from the Text Input - Mine will be called "buCombo" for reference, just replace this with your name wherever you see it.
In the advanced properties of pcCombo, set the following fields;
Select the data card, set the Update: property to;
buCombo.Selected.bu_name
That's it. Hope this helps you!
RT
Hello Russel,
I am back with the result.
Option one was not displaying the second field on Combobox was not displaying (pc_id) even it was not an error so I had tried in the new screen same thing but had no success so finally I had tried option 2.
Couple of things I had noticed while testing option 2:
Other than the above notes everything is working fine.
Thank you very much.
Hi @tusharmehta ,
It looks like you're trying to be explicit in showing only the specific field you want when you actually just need the record sets matched through the field lookup - the control will allow you to select the field you want to display with the result.
I'm not sure you need to set a variable for this, so maybe start without it and only set it if you need it for something else? Also, are you wanting to show filtered results from the first table or the second - because your formulas above do both...?
Assuming you want to show results from "Businessunits index" filtered by bu_profit_cent_id which matches a corresponding Profit_cent_id lookup on "Profit center index", then on your second dropdown/combo Items: property;
Filter(
businessunits_index,
bu_profit_cent_id = DataCardValue2.Selected.profit_cent_id
)
With the records filtered, you can then set the Value of the field to display on the combo properties instead of trying to specify it in the formula.
Hope this helps,
RT
Thanks, RusselThomas,
I had done and I was able to filter the data and it is working as expected.
While submitting the form profit center value is getting saved but in the second value in which we used to filter, the SharePoint list value is blank.
The difference which I have found:
Before writing filter on items paramters (data is getting saved)
Choices([@ledger_ac_transaction].businessunits_name)
After we replace choices with filter (Data is not getting saved and value is blank).
Does this because we replace filters and that had converted value and it is not getting saved?
Please let me know if that is correct than what could be the correct statement for filter data as well save data to Sharepoint List as well.
Hi @tusharmehta ,
So we initially had two lists - Profit_center_index and Busineessunits_index
The control however seems to have been getting it's list of Items: from a choice column on another list - ledger_ac_transaction.
Choices([@ledger_ac_transaction].businessunits_name)
This means that in SharePoint there is a choice column which uses a SharePoint defined list of values to capture data into that column. The Items: list is therefore coming from those items defined for that choice column.
Is that your intent? I mean, is there a problem with the list of choices in that column that you want to filter from somewhere else?
Or do you want to filter the list of choices that are there?
If so, is there a link between ledger_ac_transaction and Profit_center_index, like there is between Profit_center_index and Busineessunits_index?
At the end of the day, the Update: property of the card determines what get's saved back to your source, so if you were using a dropdown with a single selection for the second list of items then it should read something like this;
secondDropdown.Selected
If you are managing the list of items using the choice column in SharePoint, then you may want to rather filter that. If you're getting your list data from another source and try and save something that doesn't currently exist in the Choices of the SharePoint column - you will get an error.
Kind regards,
RT
Hello Russel,
In profit_center_index I have following fields:
In businessunits_index I have the following fields
Above mentioned both lists is having a common field (bu_profit_cent_id - profit_cent_id)
Third ledger_ac_transaction I have the following fields:
The requirements:
When the user start a new entry he will select the profit center from the first Combobox and base on the selection second Combobox (business units list will be populated and the user will select one from the list and submtit the entry.
While submit form:
in ledger_ac_transaction I want to store all the values and in this list profit_cent_name and business_name will be from two Combobox.
I may be taking more than require time because I am new to SharePoint and getting used to it.
Hi @tusharmehta ,
Ok, so just to make sure I understand - you're saying your Sharepoint column types for profit_cent_name and businessunits_name in the ledger_ac_transaction list are already Lookup column types to those lists?
If so, then filtering the comboBoxes with the sources directly disregards the lookup function of the SharePoint Column - which is why trying to save a result from that is blank.
My opinion: When it comes to building Power Apps from SharePoint lists, lookup columns are just headaches waiting to happen, so always go for simple column types and rely on Power Apps to control the user experience. If you're stuck with them however, then hopefully this still helps you.
I should add, that unless you actually need the columns to be lookup columns in SharePoint, you can make your life a whole lot easier by removing them and instead recreating these two columns to be plain text columns. It will save you a lot of headaches. If for some reason you absolutely need them to be lookups, then forge ahead. I'll answer in two parts - one for lookup columns, one for plain text columns.
I'd also suggest, before you continue, that you create a new form so we can start everything again from default and not have to worry about previous changes.
#Part1: Keeping your lookup columns
So, if we're using lookup columns, we must use the results of a Choices() function to ensure what we save back to SharePoint matches up with what SharePoint expects for that column type. This is why our Filter() function direct on the source is coming up Blank when we submit it. It's not the bu_name we need to store, it's actually a reference to a record (usually just the ID of the record) that contains the value and SharePoint is just displaying the value from a specific column in that record based on your column configuration. The Choices() function allows us to pick a record from a list and the control ensures the correct reference is stored back in SharePoint. Therefore, we're stuck with it.
It is possible however to Filter those choices - but if our filter depends on another column, (like profit_cent_id), then this is a problem. By default the Choices() from a lookup column only contain the actual column values, not the entire record - meaning profit_cent_id is not available to us to go perform filters on. Initially, our Choices() table coming from
Choices([@ledger_ac_transaction].businessunits_name)
looks like this;
We want to filter that based on the profit_cent_id associated with each bu - but it's not there for us to filter. Luckily, if our bu_names are unique, we can use these values to go and fetch their corresponding profit_center_id values using AddColumns() and our own LookUp() function in PowerApps.
This is very inefficient, as not only is SharePoint fetching the choices initially, but we're now also performing our own lookup for each Value to the same source list which makes every call redundant - so - highly inefficient, but doable.
So first, let's look at how we add the columns we need [just for reading, you don't need to set this anywhere just yet];
AddColumns(
Choices([@ledger_ac_transaction].businessunits_name),
"pc_id", LookUp(businessunits_index, bu_name = Value, profit_center_id)
)
This should give us the following list for our bu_name Combo box
Note: This will only work properly if your bu_names are unique in businessunits_index list.
Now that we have some way to filter our choices, we can wrap the above function in a Filter function. Set the buCombo Items: property to this;
Filter(
AddColumns(
Choices([@ledger_ac_transaction].businessunits_name),
"pc_id", LookUp(businessunits_index, bu_name = Value, profit_center_id)
),
pc_id = pcCombo.Selected.ID
)
If you created a new form like I suggested up front, then the defaults for the card Update: property should remain. Now if you submit the form, it should work?
#OPTIONAL Part2: using plain text columns
If you'd like to clean things up a bit, and if you expect people to only use your Power App to capture data into your list, you may want to use plain text columns to store the data instead of lookup columns.
You can't convert lookup columns, so you have to create new columns to hold the data.
To be safe, I'd rather add two plain text columns with slightly different names, and once everything is working fine and you're happy with the results, then you can remove the lookup columns...so for now, let's assume your ledger_ac_transaction list now has two additional columns that are plain text - pc_textname and bu_textname.
With the new columns added, refresh your ledger_ac_transaction source in PowerApps by selecting data sources and then clicking the ... menu next to ledger_ac_transaction and click Refresh.
Then, add an Edit form, connect it to ledger_ac_transaction and set it's default mode to New.
Because they are plain text columns, the pc_textname and bu_textname DataCards will default to Text Input controls, and the card's Update: property will point to each Text Input's .Text output by default. There are few ways to change this to suit our combo needs, but I'll opt for the cleanest - which means removing the Text Inputs, adding Combo's and changing the DataCard Update: values to point to the Combo's instead.
pc_textname DataCard
Select the Card, right click and select "Unlock"
Select the Text Input and copy it's name - we're going to reuse it
Delete the Text Input - ignore any errors for now. Insert > Input > Combo box.
Ignore the "Select Data Source" popup and edit the Items: property in the formula bar to;
profit_center_index
Rename the ComboBox and paste the name of the TextInput (it should be something like DataCardValue with a number eg: DataCardValue23). For reference in my formula here I'm going to use "pcCombo" as the name, just so it's easier to reference - wherever you see pcCombo in my formula just replace it with the control name you copied for the profit center combo box.
In the advanced properties of pcCombo, set the following fields;
Select the data card, set the Update: property to;
pcCombo.Selected.profit_cent_name
If you copied the original name of the Text Input and renamed the combo then you shouldn't see any other errors.
If you still see errors on the card, they are likely references to the TextInput control that was there. For example, the error text usually hangs underneath the Text Input with a Y: property of DataCardValueNumber.Y + DataCardValueNumber.Height. If your text input is gone and your combo isn't called DataCardValueNumber, then you'll get errors.
To fix these, either go and update the reference DataCardValueNumber to whatever you called your combo, or just name combo DataCardValueNumber and the errors will be fixed.
bu_textname DataCard
Select the Card, right click and select "Unlock"
Select the Text Input, copy it's name, then delete the control - ignore any errors for now.
Insert > Input > Combo box.
Ignore the "Select Data Source" popup and edit the Items: property in the formula bar to;
Filter(
businessunits_index,
bu_profit_cent_id = pcCombo.Selected.profit_cent_id
)
Rename the ComboBox and paste in your copied name from the Text Input - Mine will be called "buCombo" for reference, just replace this with your name wherever you see it.
In the advanced properties of pcCombo, set the following fields;
Select the data card, set the Update: property to;
buCombo.Selected.bu_name
That's it. Hope this helps you!
RT
Highly Appreciated Russel Thomas for providing an explanation with options.
Especially I am new so it will be this will motivate me and this notes will be useful for future referance as well.
After reading the details it looks that this will work for me but let me go slowly and read the instruction and perform the test.
Once again, Russel, I am very happy to read the responses they are motivating and pushing me to work harder and build one working application demo and recommend products to use in our daily office activity.
Hopefully, after following step-by-step instructions I will be able to build a demo without any issues, and if anything I will get back to you with my query.
God Bless you, Russel.
Hello Russel,
I am back with the result.
Option one was not displaying the second field on Combobox was not displaying (pc_id) even it was not an error so I had tried in the new screen same thing but had no success so finally I had tried option 2.
Couple of things I had noticed while testing option 2:
Other than the above notes everything is working fine.
Thank you very much.
Hi @tusharmehta ,
Delegation warnings appear when we use functions in our filters that the source can't understand. In these instances, the query cannot be delegated to SharePoint - so SharePoint will instead just return the first 500 rows of data, then PowerApps will apply the query on that set of data.
If your tables have more than 500 rows, then this can be a problem.
If your tables don't have more than 500 rows (and if they won't ever have more than 500 rows) then you can ignore the warnings.
If they do have more than 500 rows, or you suspect they may grow beyond 500 sometime in the future, then you should see if you can reconstruct your filters in such a way that they support delegation.
That said - you will always get warnings with Combo boxes connecting to SharePoint without adding any fancy filter functions because combo boxes have a built-in "Find" feature that actually uses the Search() function in the background. The Search() function is not delegable with SharePoint (or anything else at this point) - so as soon as you connect a combo to SharePoint you'll see the yellow warning pop up.
Because it's built in, you either have to switch IsSearchable: off to remove the warning, use a collection instead of a source like SharePoint, or just ignore it.
May I ask, how many rows exist in your profit_center and business_unit lists?
Kind regards,
RT
the number is less than 500. I will stop the search option.
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!
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
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.
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