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

Combine 2 functions in ITEMS property of a table

Hello,

 

I'm a beginner with PowerApps. I created a connection to D365 Fin Ops and want to combine data of 2 tables into one. At the same time I would like to sort the data. I have the functions, but they cannot work simoultaneously. Sounds simple but I cannot figure it out.

 

Here's the code. How can I combine these 2 functions in the ITEMS property of my table? Or do I need to place this somewhere else? I've tried to put the AddColumns part in the OnStart event of the app, but that does nothing.

 

Sort(
     Filter(
            PurchaseOrderHeadersV2,(IsBlank(TextPOSearch.Text) || TextPOSearch.Text in 'Purchase order' )
      ),
         'Purchase order',Descending
),
AddColumns(PurchaseOrderHeadersV2, "Country from VendTable", LookUp(VendorsV3, VendorAccountNumber = PurchaseOrderHeadersV2[@'Vendor account'], AddressCountryRegionId));
1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @RGommersElcee ,

Try the below

Sort(
   AddColumns(
      Filter(
         PurchaseOrderHeadersV2,
         (
            IsBlank(TextPOSearch.Text) || 
            TextPOSearch.Text in 'Purchase order'
         )
      ),
      "Country from VendTable", 
      LookUp(
         VendorsV3, 
         VendorAccountNumber = 'Vendor account'
      ).AddressCountryRegionId
   ),
   'Purchase order',
   Descending
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

9 REPLIES 9
WarrenBelz
Super User
Super User

Hi @RGommersElcee ,

Try the below

Sort(
   AddColumns(
      Filter(
         PurchaseOrderHeadersV2,
         (
            IsBlank(TextPOSearch.Text) || 
            TextPOSearch.Text in 'Purchase order'
         )
      ),
      "Country from VendTable", 
      LookUp(
         VendorsV3, 
         VendorAccountNumber = 'Vendor account'
      ).AddressCountryRegionId
   ),
   'Purchase order',
   Descending
)

 

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.

Visit my blog Practical Power Apps

RGommersElcee
Frequent Visitor

Hi Warren, this worked like a charm. Thank you so much 🙂

RGommersElcee
Frequent Visitor

@WarrenBelz small follow up question, I'm almost there.

I would like to filter on the newly created column "Country", but it is not working as expected. Perhaps because the column is only defined later in the same function. How can I do the filtering now?


D365PowerAppsFilterColumn.jpg

@RGommersElcee ,

Correct - it does not exist at the time of the filter execution - you could do this

Sort(
   Filter(
      AddColumns(
         PurchaseOrderHeadersV2,
         "Country", 
         LookUp(
            VendorsV3, 
            VendorAccountNumber = 'Vendor account'
         ).AddressCountryRegionId
      ),
      (
         IsBlank(TextPOSearch.Text) || 
         (
            TextPOSearch.Text in 'Purchase order' || 
            TextPOSearch.Text in 'Vendor name' || 
            TextPOSearch.Text in 'Vendor account'
         )
      ) && 
      Country = DropdownVendorsCountry_1.Selected.Result
   ),
   'Purchase order',
   Descending
)

 

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.

Visit my blog Practical Power Apps

RGommersElcee
Frequent Visitor

You're the best. Thanks a lot Warren 🙂

prwdeak
New Member

@WarrenBelz Hi Warren, I'm a beginner with PowerApps. Could you please help me with below?

How do I combine these two functions in the ITEMS property of my table? (different from the original post)

I have a toggle button and a search input box. What i have is below.

Function 1 - Filter(mylist, !Toggle1.Value = true || Status.Value="Pending")

Function 2 - Search('mylist', TextInput1.Text, "Title", "Name")

 

Thanks for any help mate!

prwdeak
New Member

Hi, I'm a beginner with PowerApps. Could you please help me with below?
I connected a SharePoint list with my power app and i have a DataTable connected to this data source.


How do I combine these two functions in the ITEMS property of my table? (different from the original post)

I have a toggle button and a search input box. What i have is below.

Function 1 - Filter(mylist, !Toggle1.Value = true || Status.Value="Pending")

Function 2 - Search('mylist', TextInput1.Text, "Title", "Name")

 

Thanks for any help mate!

@prwdeak ,

Like this

Search(
   Filter(
      mylist, 
      !Toggle1.Value || Status.Value="Pending"
   ),
   TextInput1.Text, 
   "Title", 
   "Name"
)

You're the best. Thanks a lot Warren !!!!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,919)