[Solved] Search Numeric Field

Hello there,

I have a question about the search form of an data table. I have a numeric field to search. For example: when I enter „10“ to search this, I get as a result of this search all number which include these term. For example: 10, 210, 104, …
I want only the specific number to get as the result. In this case 10 without the other ones.

Is there a setting to to this?

Greetings

Hi @sunday,

As of now the search is for the occurrence of the searched text within all the text/data which we have. I don’t think it is exact match like you asked.

As of now i don’t think we have any settings for this type of exact search/match.

Thanks.

I was thinking about a solution:

Could I create a Derived Field with the formatted number with adding leading 0 when needed.

I tried to use Custom Jacvascript Logic as Derived Field.

I tried something link this:

function formatNumber(number) {
return number.toString().padStart(6, ‘0’);
}

// Example usage
console.log(formatNumber(123)); // Output: “000123”
console.log(formatNumber(9876)); // Output: “009876”
console.log(formatNumber(123456)); // Output: “123456”

Unfortunately I did not get it to work inside a Derived field. Is this possible?

Hi @sunday,

Derived field are computed for displaying on the UI such as Data Table/ Data Group so i am not sure if that will work like you mentioned.

You can try putting custom Javascript directly on the search page, so that the values get formatted there itself. Need to try if this will work or not.

Thanks.

I was thinking about saving this derived field in an normal text field in the collection afterwards. But I don’t get to work the mentioned function in the derived field. Are I am make a mistake or isn’t that just not possible in the field?

To do that on the page itself would be my next try.

I don’t think saving a deried field would work but you can try as you have suggested.

Hey, I solved it with direct JavaScript on the page. Can be closed.

1 Like

Awesome. Glad you are able to fix it.