So now what i want the user to do is, when creating a new Item, to select an Analysis-Reference item which is a lookup Column to the other List implemented in the Form.
Is it possible to filter this DropDown and only show LookUps from the Analysis-List, that are connected to the Gap-ID?
yeah it was quite difficult actually to explain what i want to achieve
let me try again with some more pictures:
I have a List GAP Analysis.
Within this List i implemented a Form and in this Form i used the Control "List or Library" to show two other Lists. (1st the big table, 2nd the small Review List at the bottom)
Both lists, have a lookup field for the original Item in the Gap Analysis List.
so when i create an item in the Review List i want the field "Analysis-Reference" to only show the items which have the same "Gap-Analysis Reference" of the original Item.
As of now it just shows every existing item of this big table list which also includes other items which do not have the link to the original Gap-Analysis Item.
Yes i know. If you look at the first entry of this post here there is a diagram which shows the relations of the list.
What i want to achieve is, that when creating a new item in one child list, it should show me only entry of the other child list which has the same parent in one lookup column
i don't think that's possible.
Probably because i cannot adress a column within a control.
And the Detection is not needed as well, because the Field i try to filter already has a lookup on this list. so it displays all the items without problem.
maybe this picture will show the intention a little bit better of what i'm trying to achieve.
So the "Analyses" List is filled out before the Review List.
And in the Review List, one should be able to create a task and link it to the "Analyses-Item" which should be reviewed.
So i try to filter the "Analyses-Reference" Field in the Review list to show only the Items of the "Analyses" which have the same "Gap-Analysis-Reference"
As I see from the screenshot, the List or Library control is in inline editing mode. In this case, you can use the code below. Please update field names in the code before testing.
fd.spRendered(function() {
fd.control('SPDataTable1').$on('edit', function(editData) {
//filter Lookup field by parent field value
editData.field('AnalysesRef').filter = "GapID/Id eq '" + fd.field("GapID").value.LookupId + "'";
editData.field('AnalysesRef').useCustomFilterOnly = true;
});
});
Nevermind. I had to change it to dialog because there was a request for the analysis-field to be multiple choice.
so i could achieve my wish to filter them based on the gap analysis request with the filter function in the forms designer.
Thanks for the help. i will definitely use this code in the future when inline editing should be mandatory.
How can i filter a LookUp Column based on string it contains ?
I do not have specific ID's or such but just know the string it should containt.
function filterLookup(){
// setting filtration
var v = 'QA'
fd.field('Approver_x0020_1').filter = "Title substringof '" + v + "'";
fd.field('Approver_x0020_1').widget.dataSource.read();
fd.field('Approver_x0020_1').refresh();
}
//filter lookup when form opens
fd.field('Approver_x0020_1').ready().then(filterLookup);