‎2024 Dec 03 6:35 PM - edited ‎2024 Dec 06 9:58 PM
Hi,
I have a search requirement for the lumira designer dashboard. The client wants to type material number/ material description and search the data and display on the dashbaord. The result should be displayed in the crosstab. I am using the following script written on the input field's change on event. The code is working fine, meaning it brings the data, but not all the matched data. if I increase the array size, its brings more data. For example if I write 50000 (var b = DS_1.getMembers("ZMATERIAL", 50000)), the code brings a few match records. 100000, brings more match records. Am I doing something wrong in writing the code? Please help me to fix the code.
var a = INPUTFIELD_1.getValue().toUpperCase(); // Convert input to upper case
var FilterList = "";
DS_1.setFilter("ZMATERIAL", a);
var b = DS_1.getMembers("ZMATERIAL", 50000);
APPLICATION.alert(a);
// If input is blank, set a to a value that ensures DS_2 is used
if (a.trim() === "") {
a = "DS2"; // Use a placeholder value to ensure it won't match any valid entries
}
b.forEach(function(element, index) {
// var elementTextUpper = element.text.toUpperCase(); // Convert element text to upper case
// var elementKeyUpper = element.externalKey.toUpperCase(); // Convert element key to upper case
// Check if input matches either the text or the key
if (Convert.indexOf(element.text, a) != -1 || Convert.indexOf(element.internalKey, a) != -1) {
FilterList = FilterList + element.externalKey + ";";
}
});
DS_1.setFilterExt("ZMATERIAL", FilterList);
// Logic to hide or show CROSSTAB_1 based on filters
var filters = DS_1.getFilterExt("ZMATERIAL"); // Changed to "ZMATERIAL"
if (filters.length > 0) {
CROSSTAB_1.setVisible(true);
CROSSTAB_1.setDataSource(DS_1);
IMAGE_1.setVisible(true);
} else {
CROSSTAB_1.setDataSource(DS_2);
CROSSTAB_1.setVisible(false); // Ensure crosstab is hidden when using DS_2
}
// Explicitly hide the crosstab if the input is blank
if (a === "DS2") {
IMAGE_1.setVisible(false);
CROSSTAB_1.setVisible(false);
}
Any comments please
Request clarification before answering.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 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.