what I am trying to build is
In a project, multiple students are participated. And there are like 10 projects and about 40 students are participated to each projects. I used search asset to find out all students who participated the project.
var result = '%result_list%'; // '["1112","1113"],["1112","1114"],'
var result_list = result.split(',');
var list = [];
for(var i = 0; i < result_list.length; i++){
var id = result_list[i].replace(/[^0-9]/g, '');
if(id && list.indexOf(id) === -1) {
list.push(id);
}
}
Students are standard page asset, which is related asset(metadata) to project. Search Page asset searches all the projects and returns all student list from project’s metadata field.
for(var i = 0; i < list.length; i++){
var id = list[i];
var getName = "%globals_get_text%"; // "Lun"
var name= "%" + "globals_asset_name:" + id + "%"; // "Lunch"
print(name.indexOf(getName)); // Errr: I am getting -1
}
Above part, we have list of asset id of students. We should be able to filter by name from the list.
var getName = “%globals_get_text%”; <-- name user put on the filter
var name= “%” + “globals_asset_name:” + id + “%”; <-- We get the asset name using keyword
If name on the filter is included to any name in the list, print something
This is my purpose of those codes.