I need to create a lookup filter for the following SQL
DECLARE @P1 uniqueidentifier = 'D21F0468-F86B-4707-9FDB-C093CF0F6F87'; SELECT UsrProductList.Name FROM UsrProductList WHERE EXISTS ( SELECT UsrProductLineOfBusiness.UsrProduct FROM UsrProductLineOfBusiness WHERE UsrProductLineOfBusiness.UsrProductId = UsrProductList.Id AND UsrProductLineOfBusiness.UsrLineOfBusinessId = @P1 )
Following this post I got as far as
"UsrProduct": { "dataValueType": Terrasoft.DataValueType.LOOKUP, "lookupListConfig": { "filter": function() { var opportunityLobId = this.get("Opportunity.UsrOpportunityLineOfBusiness").value; var filterGroup= this.Ext.create("Terrasoft.FilterGroup"); var subFilter = Terrasoft.createFilterGroup(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, *** GROUND TO A HALT HERE *** , opportunityLobId)); subFilter.addItem(); filterGroup.add(Terrasoft.createExistsFilter([UsrProductLineOfBusiness:UsrProduct].id, subFilter)); return filterGroup; } } }
However ground to a halt at `UsrProductLineOfBusiness.UsrProductId = UsrProductList.Id` in the subquery. If anyone has any clues they would be appreciated!
Like
1 comments
13:14 Jul 03, 2023
For anyone who may happen this way in the future, this was solved with
"UsrProduct": { "dataValueType": Terrasoft.DataValueType.LOOKUP, "lookupListConfig": { "filter": function() { var opportunityLobId = this.get("UsrOpportunity.UsrOpportunityLineOfBusiness").value; var filterGroup = this.Ext.create("Terrasoft.FilterGroup"); var subFilter = Terrasoft.createFilterGroup(); subFilter.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrLineOfBusiness.Id", opportunityLobId)); filterGroup.add(Terrasoft.createExistsFilter("[UsrProductLineOfBusiness:UsrProduct].Id", subFilter)); return filterGroup; } } }
The subfilter is applied to the table in the main query's column path.
Show all comments