Table Head Filter for Field

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
DGarza
User
Posts: 80

Table Head Filter for Field

Post by DGarza »

Hello everyone,

Found a little problem when searching for a name in a text field, (varchar in my MSSQL DB), specifically when using the filter search (Fields -> List Page -> Filter).

If that name has a comma (",") at the moment of searching it, it doesn't find anything.

So, what was done was, clicked the filter icon in the field, searched for a name, then selected that name (which has a comma in the name) clicked search, and found nothing.

If I edit that name and remove the comma, and do the process again, it finds it.

Can I do something to solve this problem without having to remove the commas in the names? Or is this a problem that you would have to solve?

NOTE: I replicated this problem also in the DEMO that you have, I did it in the trendmaks table, which was a very simple table to test, I did it directly in the name, I enabled the filter, and I added a comma at the end to the Audi name, I tried to find it in the filter and it did not find it.


arbei
User
Posts: 8746

Post by arbei »

Note that normally comma is used to separate values in multiple selection (the filter allows multiple selection). You may change Multiple option separator to another character, e.g. "|". However, note that this also means that multi-select values will be saved as "a|b|c" instead of "a,b,c". If you have multi-select fields previously saved with commas, you'll need to update those field values. I would suggest you to avoid comma in fields that enabled with dropdown filter.


DGarza
User
Posts: 80

Post by DGarza »

Maybe I didn't explain well, In my table I have the following 2 fields, to give an example, ID, Name; the Name field is Varchar, and in phpmaker I have it as text, so far I hope everything is ok. Well, in the data that I have in the Name field, some have a comma, but it is not separating any value, I am not bringing me the ID and Name, only in my Name field there are certain values that have comma, for example,
1.- Fredy Smith
2.- John, Rodriguez

It is not that I am separating ID, Name, not that, and I understand what you say, but it is not the case, here is that the search in the Filter is not respecting the comma, for example if I put this field as Quick Search and I search for it, it works fine, but I need it to be in the Filter.

It is a problem of the Filter, I want to know if I can do something to solve it, since, what you told me about the Multiple option separator, affected me in other things of user levels and it is not something that will be changed.


mobhar
User
Posts: 11473

Post by mobhar »

The closest approach for this is by removing the comma character from the Name field.

You may also use Row_Inserting and Row_Updating server events to remove any comma character before saving the Name value to database.


DGarza
User
Posts: 80

Post by DGarza »

If there's nothing to do for the problem, for the search engine (Select2) I need to update the values, thanks anyway.


Post Reply