cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a free text entry Input Control to use to filter results

Former Member
0 Kudos
4,735

I have previously been able to create a free text entry Input control that links to multiple variables and a page filter, that will filter your displayed results (similar to the way you can click a check-box input control. But I can remember all of the steps needed.

Accepted Solutions (0)

Answers (3)

Answers (3)

mhmohammed
Active Contributor

Hi John,

Try the below steps:

1. Create a Dimension variable v_Search Text =""
2. Create an Input Control on that variable v_Search Text, should be of type Simple Selection with input as Entry Field, leave the other properties as default and click OK.
3. If you want to filter all columns depending on the search text entered, it'll be a little lengthy formula, if you just want to see rows where a Dept Name has the characters from the search text, then create the filter as
v_Filter for Searched Text =If(Pos(Upper([Dept Name]);Upper([v_Search Text])) > 0) Then 1 Else 0
4. Create a filter on the report/tab as v_Filter for Searched Text = 1 and click OK.
5. Voila!! Let us know if that helps.
Note: If you want this Search Text to be able to filter more columns, just add the conditions for different Dimensions in the If(), and use an OR between those multiple conditions. E.g. =If(... OR ... OR ... OR ...) > 1 Then 1 Else 0

Thanks,
Mahboob Mohammed

mhmohammed
Active Contributor
0 Kudos

Hi Siddu,

I tried to update this logic as below. Input control was created on v_Search.

Existing objects:
Month (data type: Number)
Month Name (data type: String)

Variables created:
v_Search = ""
v_Search Text or Number =If(IsString([v_Search])=1) Then "String" Else "Number"
v_Filter for Searched Text =If(Pos(Upper([Month Name]);Upper([v_Search])) > 0) Then 1 Else 0
v_Filter for Searched Number =If(Pos(FormatNumber([Month];"#");FormatNumber([v_Search];"#")) > 0) Then 1 Else 0

It doesn't let me create the last variable, and throws a java exception.

v_Final Filter =If([v_Search Text or Number]="String" And [v_Filter for Searched Text]=1) Then 1 ElseIf([v_Search Text or Number]="Number" And [v_Filter for Searched Number]=1) Then 1 Else 0

That java exception is understandable, as the datatype of v_Search will be dynamic (depending on what a user enters) and because we're using different functions (IsString and FormatNumber) on that value, and one of those is bound to fail in certain scenarios (ex: if we specify a text, Formatnumber will fail as it's expecting a number datatype as input), and that's why the whole thing is falling apart.

So, I guess, you'll have to use the default search feature in a web page, by clicking Ctrl + F, and you'll see it at the bottom left (as shown in the below image), it will work just fine in any case.

Hope that helps!

Thanks,
Mahboob Mohammed

SidduKodagali
Associate
Associate
0 Kudos

Hi Mahboob Mohammed,

I followed the above steps and its working fine as long as alphabets or alphanumeric string is entered. As soon as only numbers are entered, the v_Search Text variable automatically gets converted to Number data type and the filtering fails. In my scenario, users need to/can enter only numbers or only alphabets for search. Any ideas to overcome this?

Regards

Siddu

SidduKodagali
Associate
Associate
0 Kudos

BO 4.2 SP8 P3