cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jatin
Level: Powered On

Two data source(google sheet) for Combobox

Hi there,

 

I need your help solving this issue, I woud like to add combobox to search product by "Name" or "Barcode". The issue I have is I have two google sheets( due to limitation of 2000) with 3500 products. So how can I set both Sheet2 and Sheet3 in 'Items" property of combobox. Both sheets have same column name. "Barcode", "Name", "Price". So when I search in combobox I get result from both sheets.

 

Any help would be really appriciated.

 

Thanks

4 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Two data source(google sheet) for Combobox

Hi @jatin 

 

You can use a collection for doing so. A collection can be made on either App start or the page visible.
For creating a collection you need to use the below expression:
Clearcollect(MyCollection, GoogleSheet1);
Collect(MyCollection,GoogleSheet2);
Here first query creates a blank collection with Name MyCollection and fill in all data from GoogleSheet1, then second query append data to same collection.
GoogleSheet1 and GoogleSheet2 are the data sources referring to Data sources corresponding to each sheet.
 
In case you don't want to use two separate google sheets, what you can do is:
a) Create an attribute in your google sheet which holds the row count. This can be an auto increment field which auto populates itself when the record is added. (lets Name it "SNo")
b) create a collection to store the number of loop count:
ClearCollect(LoopCount,FirstN([0, 2000, 4000, 6000, 8000, 10000],RoundUp(First(Sort(<<GoogleSheet>>,SNo,Descending)).SNo/2000,0)));
c) Now work on the main collection to get all the data, this can be done through OnVisible property of the page.
Clear(ListItems);
ForAll(LoopCount,Collect(ListItems,Filter(<<GoogleSheet>>,SNo> Value)));
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Super User
Super User

Re: Two data source(google sheet) for Combobox

Hi @jatin Screenshot_1.png

PowerApps can add up to 15000 items in an Excel Table as a static datasource.  If you don't have to make modifications  to your data in the table, it is very easy to do this and takes seconds.  You can then use the datasource as the items property for your combobox.

Google sheets has the option of saving the data as an Excel file.

Community Support Team
Community Support Team

Re: Two data source(google sheet) for Combobox

Hi @jatin ,

Could you please share a bit more about your scenario?

Do you want to set Sheet2 table and Sheet3 table both within the "Items" property of a ComboBox?

 

If you want to set your Sheet2 table and Sheet3 table both wihtin the "Items" property of a ComboBox, I afraid that there is no way to achieve your needs. Currently, within PowerApps, the ComboBox control could only be connected to only one data source.

 

As an alternative solution, you could consider merge your Sheet2 table and Sheet3 table into single one Collection, and then use the collection as data source within your ComboBox.

I have made a test on my side, please consider take a try with the following workaround:1.JPG

 

2.JPG

On your side, you need to add your Sheet2 table and Sheet3 table as data source within your app firstly.

Set the OnStart property of the App control to following:

Concurrent(
           ClearCollect(Table1, Sheet2),
           ClearCollect(Table2, Sheet3)
);
ClearCollect(MergedTable, Table1, Table2)

Then set the Items property of the ComboBox to following:

MergedTable

set the Layout of your ComboBox to Double, and configure your Primary field and Secondary field as above screenshot. Then set the SearchFields property of the ComboBox to following (search by "Name" or "Barcode"):

["Barcode", "Name"]

Please take a try with above solution, then check if the issue is solved.

 

Also please check and see if the following thread would also help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/Pulling-in-large-ish-SQL-tables/m-p/243777#M7...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: Two data source(google sheet) for Combobox

Hi @jatin 

 

At times it depends on the internet connection speed too. I have worked with data which had over 15000 records from CDS and at times it would take a fraction of a second to load and at times it would take 10 seconds or forever to load!

 

 

8 REPLIES 8
Super User
Super User

Re: Two data source(google sheet) for Combobox

Hi @jatin 

 

You can use a collection for doing so. A collection can be made on either App start or the page visible.
For creating a collection you need to use the below expression:
Clearcollect(MyCollection, GoogleSheet1);
Collect(MyCollection,GoogleSheet2);
Here first query creates a blank collection with Name MyCollection and fill in all data from GoogleSheet1, then second query append data to same collection.
GoogleSheet1 and GoogleSheet2 are the data sources referring to Data sources corresponding to each sheet.
 
In case you don't want to use two separate google sheets, what you can do is:
a) Create an attribute in your google sheet which holds the row count. This can be an auto increment field which auto populates itself when the record is added. (lets Name it "SNo")
b) create a collection to store the number of loop count:
ClearCollect(LoopCount,FirstN([0, 2000, 4000, 6000, 8000, 10000],RoundUp(First(Sort(<<GoogleSheet>>,SNo,Descending)).SNo/2000,0)));
c) Now work on the main collection to get all the data, this can be done through OnVisible property of the page.
Clear(ListItems);
ForAll(LoopCount,Collect(ListItems,Filter(<<GoogleSheet>>,SNo> Value)));
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Super User
Super User

Re: Two data source(google sheet) for Combobox

Hi @jatin Screenshot_1.png

PowerApps can add up to 15000 items in an Excel Table as a static datasource.  If you don't have to make modifications  to your data in the table, it is very easy to do this and takes seconds.  You can then use the datasource as the items property for your combobox.

Google sheets has the option of saving the data as an Excel file.

Community Support Team
Community Support Team

Re: Two data source(google sheet) for Combobox

Hi @jatin ,

Could you please share a bit more about your scenario?

Do you want to set Sheet2 table and Sheet3 table both within the "Items" property of a ComboBox?

 

If you want to set your Sheet2 table and Sheet3 table both wihtin the "Items" property of a ComboBox, I afraid that there is no way to achieve your needs. Currently, within PowerApps, the ComboBox control could only be connected to only one data source.

 

As an alternative solution, you could consider merge your Sheet2 table and Sheet3 table into single one Collection, and then use the collection as data source within your ComboBox.

I have made a test on my side, please consider take a try with the following workaround:1.JPG

 

2.JPG

On your side, you need to add your Sheet2 table and Sheet3 table as data source within your app firstly.

Set the OnStart property of the App control to following:

Concurrent(
           ClearCollect(Table1, Sheet2),
           ClearCollect(Table2, Sheet3)
);
ClearCollect(MergedTable, Table1, Table2)

Then set the Items property of the ComboBox to following:

MergedTable

set the Layout of your ComboBox to Double, and configure your Primary field and Secondary field as above screenshot. Then set the SearchFields property of the ComboBox to following (search by "Name" or "Barcode"):

["Barcode", "Name"]

Please take a try with above solution, then check if the issue is solved.

 

Also please check and see if the following thread would also help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/Pulling-in-large-ish-SQL-tables/m-p/243777#M7...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jatin
Level: Powered On

Re: Two data source(google sheet) for Combobox

Hi,

Thanks again for your help, it worked the way I want but app takes bit time to load as I have huge data.

 

Regards,

 

Jatin

jatin
Level: Powered On

Re: Two data source(google sheet) for Combobox

Thanks @yashag2255 , this was alos helpful to achieve the result. Thanks for pormpt help.

 

Super User
Super User

Re: Two data source(google sheet) for Combobox

Hi @jatin 

 

At times it depends on the internet connection speed too. I have worked with data which had over 15000 records from CDS and at times it would take a fraction of a second to load and at times it would take 10 seconds or forever to load!

 

 

Highlighted
jatin
Level: Powered On

Re: Two data source(google sheet) for Combobox

Hi @Drrickryp , Thanks for the suggestion, This is a possible solution for me, which I can use in another scenario. 

 

Thanks,

jatin
Level: Powered On

Re: Two data source(google sheet) for Combobox

Hi @yashag2255 , You are right, I was using on my mobile data but on Wi-Fi it is only 10 seconds.  Thanks