If you are unable to create a new account, please email support@bspsoftware.com

 

Disable Wildcard search in Search and Select Prompt i.e dont allow search by %

Started by zamcognos, 04 Feb 2016 10:22:25 AM

Previous topic - Next topic

zamcognos

Hi All,

I have a Single Select Search and Select(SnS) prompt, where Search by Wildcard '%' should not be allowed.
Basically Search by % would show all the values and that could result in performance issues.we have around 200K values for the prompt.

I was thinking if a Javascript needs to be created that will validate the SnS prompt and when the user searches by % it will show a message
"Search All using wildcard characters is disabled please search for specific values"

Any Help is much appreciated.

Thanks.

zamcognos

I have had some sucess with this. I am able to get the value of the Entered text and check if its % or not, But only one thing is pending. i.e even after the message "", Search Result box is displayed with the values in the prompt. I don't want to search for values when % is entered.

if(SelectedRadio == 'ACCOUNT_CUSTOMER')
prompt = 'ACprompt';
else if (SelectedRadio == 'BILLING')  prompt = 'Aprompt'; else prompt = 'Pprompt';
Var EnteredValue=ValidateSnSKeyword(prompt);


if(EnteredValue=='%')
{
alert('Search All using wildcard characters(%) is disabled please search for specific values');
}

function ValidateSnSKeyword(SpanID){
var mySpan = document.getElementById(SpanID);
var myInput = mySpan.getElementsByTagName("input");
return myInput[1].value;
}


zamcognos

Finally Solved..below is the code.

if(EnteredValue=='%')
{
alert('Search All using wildcard characters(%) is disabled please search for specific values');
clearSearchValues();
}

//Update the values for i based on which prompt you want to clear
function  clearSearchValues() {
var oCR = cognos.Report.getReport("_THIS_");
var aControls = oCR.prompt.getControls();
for (var i = 4; i < aControls.length; i++) {
aControls.clearValues();
}
}