on 2024 May 29 3:16 PM
I have enabled the search property to TRUE and as its behaviour, it is going to search for all the properties that are binded in the table. So how to make it work for only one property.
Request clarification before answering.
@dwipal Please use this snippet for your rule
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jitendra_Kansal78, Thanks for the above approach. It worked but when i am adding additional query it did not working as earlier. So basically I get the customers based on the product associated with the customers and after that i search the customer name, so initially for empty search string it is working fine. it only fetch those customer which are equal to the given productId. But when i start searching for name it search from all the data list instead of those customer that are equal to the productId only.
let pageClientData =context.binding;
let productId = pageClientData.productId;
// Simple value assignment.
let search = context.searchString;
let qoB = context.dataQueryBuilder();
if (!search) {
let productFilter = qoB.filterTerm(`ProductId eq '${productId}'`);
qoB.filter(productFilter);
}
console.log("qoB",qoB);
if(search && search != ''){
let username = qoB.filterTerm(`substringof(tolower('${search}'),tolower(Name))`);
let productFilterTest = qoB.filterTerm(`ProductId eq '${productId}'`);
qob.filter().and(productFilterTest,username);
}
return qoB;
Hello @Jitendra_Kansal78, The issue regarding productID is also resolved. Thanks for your suggestions and help
let pageClientData =context.binding;
let productId = pageClientData.productId;
// Simple value assignment.
let search = context.searchString;
let qoB = context.dataQueryBuilder();
let appFilter =`ProductId eq '${productId}'`;
if (!search) {
qoB.filter(appFilter);
}
if(search && search != ''){
let username = qoB.filterTerm(`substringof(tolower('${search}'),tolower(Name))`);
qoB.filter(appFilter).and(username);
}
return qoB;
You can write a rule for the Object Table Target Query Options to customize the search string to restrict the required search.
E.g.,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jitendra_Kansal78, Here i am shring page schema and rule which i have created.
{
"Controls": [
{
"_Type": "Control.Type.SectionedTable",
"_Name": "SectionedTable0",
"Sections": [
{
"_Type": "Section.Type.ContactCell",
"Target": {
"Service": "/MDKApp/Services/sample.service",
"EntitySet": "WSoldToSet",
"QueryOptions": "/MDKApp/Rules/SearchCustomerListName.js"
},
"_Name": "SectionContactCell0",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"Separators": {
"TopSectionSeparator": false,
"BottomSectionSeparator": true,
"HeaderSeparator": true,
"FooterSeparator": true,
"ControlSeparator": true
},
"ContactCell": {
"Visible": true,
"ContextMenu": {
"PerformFirstActionWithFullSwipe": true
},
"DetailImage": "res://contact.png",
"Headline": "{Name1}",
"Subheadline": "{Btgew}",
"Description": "{Anzpk}"
},
"DataPaging": {
"ShowLoadingIndicator": false,
"PageSize": 50
},
"Search": {
"Enabled": true
}
}
],
"FilterFeedbackBar": {
"ShowAllFilters": false,
"_Type": "Control.Type.FilterFeedbackBar"
}
}
],
"_Type": "Page",
"_Name": "Customer_List",
"Caption": "Customer_List",
"PrefersLargeCaption": true
}Rule
/**
* Describe this function...
* @param {IClientAPI} context
*/
export default function SearchCustomerListName(context) {
let pageProxy = context.getPageProxy();
console.log("pageProxy",pageProxy)
let search = context.searchString;
console.log("search",search)
let qoB = context.dataQueryBuilder();
console.log("qoB",qoB);
if(search && search != ''){
let productname = qoB.filterTerm(`substringof(tolower('${search}'),tolower(Name1))`);
console.log("productname",productname);
const test = qoB.filter().or(productname);
console.log("test",test);
}
return qoB;
}
| User | Count |
|---|---|
| 18 | |
| 8 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.