Single Gallery from multiple sharepoint list (all same fields) - sharepoint

Currently my powerapp is having a Gallery which is based on a single sharepoint list but i would like to implement a gallery on my app which should show items from 3 different sharepoint lists (all have same columns/fields) and i am using a filter on the galley so that user can type on the box and get filtered response only instead of showing all data
Please Help
I am already having this formula in gallery1.items :
Search('PO list', TextSearchBox.Text,"Branch_x0020_Code")
For example,consider i have 2 list : list 1 & list 2 ,now when an user searches in the searchbox (i.e. TextSearchbox) i want the gallery to filter the data wherein "Branch_x0020_Code" equals search data from both the List
EDIT 1 : This is the formula i am trying to implement :
Formula : ClearCollect(Aitems,'PO list',PO 2)
and error is shown as in the following image:
My "PO List" was having a column called status and its type was Single line of text whereas in "PO 2" the type of status column was Choices .since i cannot change the datatype i have changed one of the list column name to "Status 0" .
Now the only difference i have between these two lists are one list has some extra columns while other don,t have.
But still when i am trying ti implement i am getting this "Incompatible type" error.

Galleries can't directly show results from multiple data sources at one time. However one way to achieve this is to first collect data from the various lists into a single collection, then bind the gallery to that collection.
For example you could do this in the OnStart property of the app, or the OnSelect property of an "update" button:
ClearCollect( CombinedListsCollection,
List1, List2, List3 )
Then bind the gallery.items to the collection instead:
Search( CombinedListsCollection, TextInput.Text, [columns])
Another way to get at this is to collect dynamically a filtered set of records as your users search. For example, on your Text Input control for the search box, set the "OnChange" property to:
ClearCollect(CombinedFilteredLists,
Filter(List1, StartsWith(Title, TextInput1.Text)),
Filter(List2, StartsWith(Title, TextInput1.Text)))
Then set the gallery items to CombinedFilteredLists.
Use StartsWith() wrapped in Filter() to delegate over large SharePoint lists as in the example above.
Here's a gif of that in action:
Combining two SharePoint lists into one Gallery in PowerApps

If you have the exact same columns/fields for the two lists, then Ryan's solution would work. However, if some of the fields are different (either their name or type), then you can use one of the many functions that can help you change the "table shapes" in PowerApps.
In your specific case, if you have the following two lists in SharePoint:
List01
Title (Text)
Status (Text)
List02
Title (Text)
Status (Choice)
Then you can create a collection with the contents of both lists by using this expression:
ClearCollect(
ItemsCollection,
ShowColumns(
AddColumns(List01, "StatusText", Status),
"Title", "StatusText"));
Collect(
ItemsCollection,
ShowColumns(
AddColumns(List02, "StatusText", Status.Value),
"Title", "StatusText"));
The expression above creates a new column (*) called 'StatusText' on both lists, normalizing the type of the Status column to text, and then select the Title and StatusText columns from the two lists, thus ensuring that the schema (types of the fields) are the same.
(*) The AddColumns function doesn't create any additional columns in the SharePoint list; instead, it returns a new "virtual" table that can be used within expressions / controls in PowerApps.

Related

How do I use a power apps form for a lookup column?

I have a SharePoint List (say "List-A") with plenty of columns, some of which are lookup columns.
These are just used to construct a choice columns, where the items in the choice drop down are the items of a column in a different List ("List-B").
I have used the function on SharePoint to integrate List-A with Power Apps Form. This creates a Power Apps form that is readily available.
For the Lookup choice columns, I have added List-B as the data source, and am using the items from the correct column as items in the choice that is linked to the lookup column. This correctly populates the drop down menu as expected.
Now when I publish this form and fill it from sharepoint (it pops up as it should hafter clicking New in the List view) I can fill the entire form and submit with no issue. However all the lookup columns remain blank, as if the form returned a null value instead of the selected.
I have both datasources set up:
The update property of the datacard connecting to the SharePoint List is equal to the Selected of the datacard containing the combobox (combobox is called DataCardValue43).
The items property of the combobox is equal to the correct column of List-B.
As an alternative solution, I have attempted to make a different column that is just one line of text. For this column, I have made a combobox once again setting the items property to the column in List-B. The intention was to return the selected value as a string. It was attempted thus:
where combobox1 once again manages to give the correct options in the drop down box but returns only Null.
To study it further, I have made a power apps flow that takes Create New Sharepoint List object as input. Here I see that the values are indeed Null
The one called "Return" is the text column that I made, and the other being the lookup column. I do notice that the Lookup column isn't called Value, but id. I don't know what to do with that information though.
I really just want to have a column in my power apps form that lets you choose and the choices are values from a column in a different List. What do I do, and why doesn't what I've already done work?
Thank you.
Please follow the steps below to solve the issue.
1: Add a Lookup column in SharePoint List.
2: Open that list in Power Apps by using the Customise Forms Option From SharePoint.
3: The Item property of Lookup field will be by default as follow:
Choices([#'CustomisingSharePointList'].LookupColumnListName)
4: There is no need to change/delete the lookup field with any custom dropdown or combo box. This is the point, where you are doing mistake by adding a custom combobox and replacing the original Lookup dropdown. If you want to change datasource, apply filter or sort the data, you can do all these thing to the same original lookup column.
e.g I have applied filter and sort functions to the existing data:
Sort(Filter(Choices([#'CustomisingSharePointList'].'LookupColumnListName'), Value in Filter(LookupColumnListDataSoure,Progress.Value = "Open").ID),Id)
5: When you will publish the list, it will work fine.
Note:
CustomisingSharePointList: List in which we have added a lookup column.
LookupColumnListName: List to which the lookup column actually belongs to.
LookupColumnListDataSoure: You need to add the original list as data source in power apps to use the above filter. This step is optional and applicable only if you apply filter like I did in step 4

Insert Rows from SharePoint List into Excel in Order Using Microsoft Flow

I need to create an excel document daily that captures any changes to a SharePoint list.
The list on SharePoint contains the columns 'vendor' / 'product' / 'promotion' and is sorted by vendor first, and product second.
Using the 'Get Items' SharePoint connector to feed 'Insert Rows' Excel connector is yielding the correct result, except that it is not putting the items in the order they are displayed on the SP list (sorted by vendor, then product). It is adding them to excel in the order they were added to the sharepoint list (I. E. The last addition to the sharepoint list is last on the excel table).
I am using insert row instead of create table or create worksheet because the formating of the cells must be maintained. By leaving the first cell in my template intact and deleting all of the old entries before getting the updated ones, the formatting is preserved.
There are actions updstream and downstream within my flow that I would like to preserve, so using an alternative solution to Flow is not ideal.
Is there a way to bring the sharepoint row items in order?
There was two factors mitigating the results of my flow:
1) There seems to be some bug that if you do not "Filter By" the items, applying an "Order By" paramater wraps the action in an apply to each, which is unworkable.
2) Looking at the server responses from the Flow report, I noticed that the Display names of some of the columns in my SharepPoint List were not the same as my column header. In my case, I renamed "Title" to "Partner", but it was still being identified as "Title", despite not displaying this in Sharepoint.
Overall solution was to 1) put a dummy filter in that grabbed everything in the Get Items action: "Title ne 'x'" (remove " marks when using in Filter By, means Title not equal 'x'), and 2)Using "Title asc" in Order By.

Joining sharepoint 2007 lists in a web view based on a common key field

So - I'm making a data view that is to contain a list. This list has a field that will be used to match up against two other lists. If there is an entry for this value, it should show the value from the other list, otherwise show a link to add a new one.
So, what I need to do is make a data source consisting of the rows from list 1, and fill in the Ticket field with a value from the Tickets table matching the ID value from list 1. The same should be done for the Change Type field.
Can anyone point me in the right direction to accomplish this? I've found a few tutorials, but they seem to be for showing all the data together and not match up on any specific columns for linkage.
Thank you
What you are aiming at is not available in SharePoint out of the box.
There are two approaches you can look at:
Create your own custom lookup field template for single/multiple field
selection with some sort of field
editor. Create your own controls and
program the associated code behind
logic.
Use some existing custom solutions. One such sample is on codeplex:
SharePoint Filtered Lookup Field

SharePoint 2007: Custom Lookup columns

I would create two separate lists, and have the data entered in list 1 populate some of the data columns in table 2. Example: Request Name (single line of text), Description (Multi lines of text), Type of Request (Choice), and Completion Date (date).
When I go to the second list, I select 'Lookup', then 'Get information from:', select the first list, and all I see are "ID", "Content Type", "Version" and the "Title".
What do I need to do to get the columns from list 1 to appear in the 'Lookup' section of table 2?
The lookup field will only use text columns (regular text, calculated field with output type of text and computed columns that output text). You could probably fill out the additional fields by the means of a simple SharePoint Designer workflow that will run on item creation in the second list and fill out the columns.
I have been able to do this by creating a Feature with a custom List Definition using the FieldRef, JoinColName, JoinRowOrdinal, and JoinType attributes.
For more information, see SharePoint 2010: Set field value from query triggered by choice box selection.
I think programming will be needed you will have to use something like smartpart and create your own asp.net control that will read from database and show the data as you need it

Mapping Infopath fields to Sharepoint columns

Any one has any idea how to map an infopath field to a sharepoint column of type choice? The infopath field is a repeating field, so the user can select multiple options, I want to be able to map those to the choice field in sharepoint. Any ideas?
update:
What I'm trying to do is the following. I have a choice column in sharepoint which allows user entered values. In infopath, I have a repeating field. I'm binding the field to a dropdownlist. The dropdownlist gets filled by a webservice. This dropdownlist is in a repeating section, so the user can choose to select from multiple dropdownlists. So lets say the user adds 2 dropdownlists, and selects an option from each dropdownlist. I want to be able to add those selections as choices in the sharepoint choice column.
SharePoint list is a flat structure, and because of that Infopath does not allow you map repeating sections to list columns.
You might wanna consider the following workaround:
Store Infopath form to one library
(along with non-repeating fields)
Use one of these custom activities to extract data from
repeating table and copy it to
another list
Create a custom data view or a web part to display these items (if
necessary)
This approach can be useful if you need to do some additional tasks with the repeating data.
When you are promoting fields within a repeated section into SharePoint columns, the options available are to promote the column as:
first (i.e. only the first selection is promoted)
last
count
merge (I believe this merges all the selected values together into a single entry)
screenshot http://img4.imageshack.us/img4/5539/repeatinggrouptr3.png
Is it not similar to Create a Repeating Cascading List from:
a Flat Data Source or
a Hierarchical Data Source ?
If it is, may be those two articles may give you some pointers.
Depends on the type of choice field it is.
If it is a Multiple Select (checkboxes) Choice field, you can set the field through the object model (from the sharepoint site) or through the web service, by using ";#" for each item that you want to check mark, where is the value which is listed by the checkbox. I don't remember what the option is for single choice only, but it is something of the same nature. If you are talking about lookup fields, it has to do with the index number of the field from the list you are looking it up from. Also, there is additional steps if the choice field allows users to input or specify their own options.

Resources