Add a filter criteria text box for primary key column

Add a filter criteria text box for primary key column

  
We have a support help desk module and we would like to add a filter criteria on ticket Id column which is primary key column. Out system is not allowing to do that. Also how to 
Hi there! 

It seems you left you didn't submit the entire question... Anyway filtering the ID works the same way as filtering any other attribute.

Would you mind posting a small example module so I can replicate the problem and help you fix it?

Cheers!


Hi,

How can i apply filter on primary key using like operator,it is showing error if i use like operator on primary key while applying the filter.

Thanks,

Ronan T.

Hi Hitesh,

We are not able to understand the question, Could you please provide a small example.?


Thanks

Rajendra Singh

Ronan T wrote:

Hi,

How can i apply filter on primary key using like operator,it is showing error if i use like operator on primary key while applying the filter.

Thanks,

Ronan T.

Hi Ronan,

Is it your query or its on behalf of Hitesh?


Thanks

Rajendra Singh 


Hi Hitesh,

You can apply filter on primary key in outsystems but can you please explain your question so that I can understand and reply accordingly.


Regards

-SK-

Raj wrote:

Ronan T wrote:

Hi,

How can i apply filter on primary key using like operator,it is showing error if i use like operator on primary key while applying the filter.

Thanks,

Ronan T.

Hi Ronan,

Is it your query or its on behalf of Hitesh?


Thanks

Rajendra Singh 


Hi Raj,

It is my query

Thanks,

Ronan T.


HI Raj,

I need to apply filter like this on primary key

[(Person_name) like "%" + iname + "%"] but it is showing error at like.

Thanks,

Ronan T.

 Hi Rohan

 Did you try like this-

Entityname.Person_name like "%" + iname+ "%"

and i think like can't be applied to operands of type identifier.


Thanks

Rajendra Singh


Raj wrote:

 Hi Rohan

 Did you try like this-

Entityname.Person_name like "%" + iname+ "%"

and i think like can't be applied to operands of type identifier.


Thanks

Rajendra Singh


Hi Raj,

Yes,it is showing the same error,Is there any alternate for this .

Thanks,

Ronan T


Hi Ronan,

May i know the error please, is it possible to attach the oml.


Thanks

Rajendra Singh

Raj wrote:

Hi Ronan,

May i know the error please, is it possible to attach the oml.


Thanks

Rajendra Singh

Hi Raj,

This is the error

Thanks,

Ronan T

Hi Ronan,

id is the identifier of the movie table and i have already mention in my previous post

Hi Rohan

 Did you try like this-

Entityname.Person_name like "%" + iname+ "%"

and i think like can't be applied to operands of type identifier.

so i don't think its possible with identifier.


Thanks

Rajendra Singh

Ronan T wrote:

Raj wrote:

Hi Ronan,

May i know the error please, is it possible to attach the oml.


Thanks

Rajendra Singh

Hi Raj,

This is the error

Thanks,

Ronan T

Hi Ronan,

If your Person_name is an identifier of the table do the below steps-

1-Right click on the Id (autoincrement number) and set as identifier.

2:-create an unique index by double click on table go to the index tab and create new index and select the attribute Person_name

3:- now you can use the like operator with the person_name.

Thanks

Rajendra Singh


Raj wrote:

Ronan T wrote:

Raj wrote:

Hi Ronan,

May i know the error please, is it possible to attach the oml.


Thanks

Rajendra Singh

Hi Raj,

This is the error

Thanks,

Ronan T

Hi Ronan,

If your Person_name is an identifier of the table do the below steps-

1-Right click on the Id (autoincrement number) and set as identifier.

2:-create an unique index by double click on table go to the index tab and create new index and select the attribute Person_name

3:- now you can use the like operator with the person_name.

Thanks

Rajendra Singh


Hi Raj,

Here did you treat  Person_name as a primary key?

thanks,

Ronan T.


Raj wrote:

Ronan T wrote:

Raj wrote:

Hi Ronan,

May i know the error please, is it possible to attach the oml.


Thanks

Rajendra Singh

Hi Raj,

This is the error

Thanks,

Ronan T

Hi Ronan,

If your Person_name is an identifier of the table do the below steps-

1-Right click on the Id (autoincrement number) and set as identifier.

2:-create an unique index by double click on table go to the index tab and create new index and select the attribute Person_name

3:- now you can use the like operator with the person_name.

Thanks

Rajendra Singh


Hi Raj,

I followed the same procedure,

I set person_name as a primary key and i created the new index for person_name then used like operator in filter it showed the same error again.

Thanks,

Ronan T.

Hi Ronan,

You can achieve this by following below mentioned steps ->

1. The data type of the variable bind to your input box should be "Text".

2. Apply some javascript to that input box such that user can only enter numbers in that input box.

3. The source for your table record should be the SQL query.

4. On click of "Search" button refresh the SQL query. Your query should be ->

 5. After refreshing that query ajax refresh the Table Records to see the filtered record.

Use this javascript to allow only numbers and call it on "onkeypress" event ->

SyntaxEditor Code Snippet

function onlyNumbers(){
    if(event.which>=48 && event.which<=57){
    return true;
    }
    else{
    event.preventDefault();
    return false;
    }
}

I have total 11 records in my Movie Table. If i search with "1", then i will get following result.

 I have attached the OML for your reference.

Hi Ronan,

I think you have not read the steps properly, please read it properly. person_name is still an identifier.

while creating any entity outsystem creates a default attribute (id), right click on the attribute and set it as identifier -> then create an unique index on person_name ->use the like operator with person_name attribute it should work.


Thanks

Rajednra Singh



Raj wrote:

Hi Ronan,

I think you have not read the steps properly, please read it properly. person_name is still an identifier.

while creating any entity outsystem creates a default attribute (id), right click on the attribute and set it as identifier -> then create an unique index on person_name ->use the like operator with person_name attribute it should work.


Thanks

Rajednra Singh



Hi Raj,

Ya it works ,but according to our requirement the filter has to be applied on that identifier only.

Thnaks,

Raj.


Pravi Gupta wrote:

Hi Ronan,

You can achieve this by following below mentioned steps ->

1. The data type of the variable bind to your input box should be "Text".

2. Apply some javascript to that input box such that user can only enter numbers in that input box.

3. The source for your table record should be the SQL query.

4. On click of "Search" button refresh the SQL query. Your query should be ->

 5. After refreshing that query ajax refresh the Table Records to see the filtered record.

Use this javascript to allow only numbers and call it on "onkeypress" event ->

SyntaxEditor Code Snippet

function onlyNumbers(){
    if(event.which>=48 && event.which<=57){
    return true;
    }
    else{
    event.preventDefault();
    return false;
    }
}

I have total 11 records in my Movie Table. If i search with "1", then i will get following result.

 I have attached the OML for your reference.

Hi Pravi Gupta,

I used this on aggregate it worked for me   if the primary key is integer i can use this ,but it is text in our requirement so i cannot apply this.


IntegerToText(movies.id) like "%"+var1+"%" 

Thanks,

Ronan T.


Hello,

You can use my component which provides search result output as 'like' operator in SQL for primary key column, please let me know if find any difficulty.

https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=4715

 Thanks,

Kamlesh

Kamlesh Rajput wrote:

Hello,

You can use my component which provides search result output as 'like' operator in SQL for primary key column, please let me know if find any difficulty.

https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=4715

 Thanks,

Kamlesh

Hi Kamlesh,

It is working.

Thanks,

Ronan T.



Ronan T wrote:

Kamlesh Rajput wrote:

Hello,

You can use my component which provides search result output as 'like' operator in SQL for primary key column, please let me know if find any difficulty.

https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=4715

 Thanks,

Kamlesh

Hi Kamlesh,

It is working.

How can i filter range of date using FilterList   and how can i change the list_navigation totalrowcount value based on the number of rows returned after search.

Thanks,

Ronan T.



Hi Ronan,

Find the attached oml file in which you have found date range filters using FilterList with list_navigation count value based on the number of rows returned after search performed.

Please let me know if any issues found.

Thanks,
Kamlesh

Hi,

1.If the Primary key is integer datatype  than i converted the integer value to text and applied the filter

 [ IntegerToText(Movies.id) like "%"+id+"%"] 


2.If the Primary key is Text datatype then apply  the filter by converting text to integer and then convert integer to text 

[ IntegerToText(TextToInteger(Movies.id)) like "%"+id+"%" ] 

It worked for me without showing any datatype error

Thanks

Ronan T

Hi,

We can use IdentifierToText() So that it will not show any error at like



IdentifierToText(Movies.id) like "%"+id+"%" 

Thanks,

Ronan T.