There is an API to get relating resources in OData, the Url likes this: http://services.odata.org/V4/(S(34wtn2c0hkuk5ekg0pjr513b))/TripPinServiceRW/People('russellwhyte')/Trips(0).
Can I use it in SharePoint, or is there any other API likes this to get relating resources?
Thank you for your advises!
P.S. I know that I can use Lookup field and Expand to get resources, but it cannot meet my requirements.
I have List A and List B, List B is a task list. so how can I get relating tasks when I get each item form List A by one request?
I know that I can use expand, likes ~/_api/web/lists/getbytitle('List B')/items?$select=ListA/Title,ListA/Field0...&$expand=ListA. But I don't want to get data from List B, cause I need to filter data by current user's permissions in List A.
Since the lookup is in List B and you are querying List A there is not one request to retrieve the info you are looking for. If the Lookup was in List A you could see all the List B items. Without that, you need to first query all the List B items and return all the List A item ID's, then query List A.
_api/web/lists/GetByTitle('List B')?$select=lookupColumn/Id&$expand=lookupColumn/Id
_api/web/lists/GetByTitle('List A')?$filter=Id eq 'someID' or Id eq 'someID2'
Related
I have a Sharepoint list Region with a value that is a lookup field Markets that references Markets list.
I'm able to filter by the lookup ID:
https://graph.microsoft.com/v1.0/sites/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/lists/REGION/items?expand=fields(select=PVRegion,Markets)&filter=fields/MarketsLookupId eq 1
But I want to get some fields from Markets list with this lookup attribute, as PVOps, LinkTitle, ...
Is it possible to get this with only one query? Or I need to query Markets list with the LookupId?
Unfortunately you'll need a separate query to get those values. This is particularly frustrating when dealing with users since you only get the ID of the given user as it appears in the UserInformation list.
I am wondering if anyone has a solution for this issue that I am facing. I have finished building a repeating table solution involving 2 SharePoint lists.
List A - This is the main list where the form is hosted to do all the data entry.
List B - This is the list that handles repeating data. It has a column named Base_ID that contain the matching ID from List A (there could be 10 items in List B that goes with 1 item in List A).
What I am looking to do is, create a flow that will get all the data from both lists and do (what you would do in MySQL) is a left join.
Now I did find https://powerusers.microsoft.com/t5/Using-Flows/Merging-two-datasets-in-Power-Automate/td-p/944323 and https://powerusers.microsoft.com/t5/Building-Flows/Join-Two-Datasets-in-Flow/td-p/354458 and I have seen comments regarding performance.
Does anyone here know if there is a faster way to do all of this?
You may want to explain the need to have the data all in one list.
This looks like a parent/child relationship, with multiple records in list B relating to one item in list A. I would just leave this alone.
If you want to build forms with this data, that is no problem with PowerApps. You can build screens that show the parent item and a table of all related items by filtering list B with the ID from the List A item. You can add/remove/edit items from List B in PowerApps easily.
If you want to run reports on the data with Excel and Power BI, pull the two list as separate queries and do a merge (i.e. join) in the Query editor.
That way you can keep the data normalized and avoid duplication of values.
Edit after comment: To join the data from the two lists, so you can compose an email notification, you can use the following approach:
Use Get Items from list A that require processing
for each item in the list (Outer loop)
Get items from list B where the ID matches the A item ID
for each item returned from list B (inner loop)
write item details into a collection
next item from list B (end inner loop)
send notification with item details
next item from list A (end outer loop)
This kind of processing is not hard to do and unless you have thousands of records it will not take too long to process.
I'm working on a project for work, and I'm attempting to move data from a database with multiple references to different tables.
My question is; is it possible to move the data and be able to have a list that references different lists? For example, when I click on an element in the list, can I create another "link" to take me to another list?
I am not sure but if I understand the problem well You would like to create some kind of column in one list which will store reference to item from other list, correct?
If so then You are looking for lookup columns. When adding column to a list You may select lookup column type, after that You need to select which list You would like to 'reference' and which column should be present from the second list in the lookup column from the first list. Please check the reference link
OOB lookup column(similar concept as database foreign key) will be good, while CSR will be helpful for complex scenario also.
I have one Sharepoint list that contains training courses and duration (in hours). I have another list where users can enter the training they have and plan to take (using a Lookup column connected to the first list)
Is there a way I can bring over that Hours column to display on the second list? I only have access to the vanilla web parts and SPD, and I am not allowed to add third-party stuff (solutions/web parts) on the SP servers.
I just need that Hours column to appear in the list itself without users needing to click the lookup field (course title)
If you have multiple column field type and you use that as lookup field. You can get two column values in one field. It will show up as two different columns on list but you will need render templates for input forms. Check this out for basic idea
http://msdn.microsoft.com/en-us/magazine/dd727508.aspx#id0450138
Create a field type for course list
Create render template for MCV and extend SPFieldMultiColumnValue
Make that field as Lookup Column
You have to check if you can do second step using SPD only. Also another way to do it is using Multiple column lookup field
HTH
SharePoint Lookup field, what is it?
Please share, thanks.
It is a type of field used to indicate that the possible values of a column in a list must be taken from the elements of another list. For example, if you have a list of users, and one column of this list is the country, you can create a lookup field pointing to another list "countries" which contains the possible values to select.
If you think in terms of relational databases, a lookup field is a foreign key: you only store a reference to the related item, not its value.
For instance, you have a list of meeting rooms. You can create a meeting calendar by creating a new calendar list with a lookup to the "Meeting rooms" list. Hence, when organizing a meeting, you will be able to pick a room from the list of meeting rooms entered previously.
A "Lookup" differs from "Choice" field as you may alter the source item and the referencing item is updated automatically. For instance, you change the name of a meeting room - all meetings booked for that room will show the new title automatically.