Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Insert Commas before and after search string

Featured Replies

  • Newbies

I have a button linked to a script that lets me scan a barcode or type an inventory number to quickly find the specific inventory record. I would like to speed up my searching by automatically inserting my required parenthesis "()" at the beginning and end of the 4 digit number I scan into the custom dialog box I set up. How do I do this (what function(s)) should I use? My inventory numbers are all 4 digit numbers (no longer or shorter) and start and end with a parenthesis (so it's barcode scan-able when printed,) they use this format: (1234)

My current script is:

Enter Find Mode

Show Custom Dialog (Search/Cancel Buttons + 1 Field)

Perform Find

PS. If there is a way to simply tell FileMaker not to require those parenthesis while searching, that would be even easier and cleaner I suspect!

Are you manually entering primary keys? I hope not. You should have an auto-entered key, and then a display calc field for the printing: "(" & keyfield & ")"

I have a button linked to a script that lets me scan a barcode or type an inventory number to quickly find the specific inventory record. I would like to speed up my searching by automatically inserting my required parenthesis "()" at the beginning and end of the 4 digit number I scan into the custom dialog box I set up. How do I do this (what function(s)) should I use? My inventory numbers are all 4 digit numbers (no longer or shorter) and start and end with a parenthesis (so it's barcode scan-able when printed,) they use this format: (1234)

My current script is:

Enter Find Mode

Show Custom Dialog (Search/Cancel Buttons + 1 Field)

Perform Find

PS. If there is a way to simply tell FileMaker not to require those parenthesis while searching, that would be even easier and cleaner I suspect!

Enter Find Mode

Show Custom Dialog (Search/Cancel Buttons + 1 Field)

if get (lastmessagechoice) = 1

setfield (searchfield; ( "(" & searchfield & ")")

Perform Find

exit script

elsif get (lastmessagechoice) = 2

<<<enter whatever you want to do if someone choses to cancel>>>>

end

Btw, this could be handled a little easier using a layout with a field due to being able to use a script trigger instead of a scripted dialog box. Scanners can be programmed to issue an exit command, so can perform a find on field exit using script trigger that formats the field for you similar to above.

You could use:

Enter Find Mode

Show Custom Dialog (Search/Cancel Buttons + 1 Field)

Set Field [ InventoryNumber ; : "(" & InventoryNumber & ")" ]

Perform Find

However, it would be much simpler to add the parentheses only where you really need them, as Barbara suggested. If the only need is for printing, you could simply type them on the layout.

I have a button linked to a script that lets me scan a barcode or type an inventory number to quickly find the specific inventory record. I would like to speed up my searching by automatically inserting my required parenthesis "()" at the beginning and end of the 4 digit number I scan into the custom dialog box I set up. How do I do this (what function(s)) should I use? My inventory numbers are all 4 digit numbers (no longer or shorter) and start and end with a parenthesis (so it's barcode scan-able when printed,) they use this format: (1234)

My current script is:

Enter Find Mode

Show Custom Dialog (Search/Cancel Buttons + 1 Field)

Perform Find

PS. If there is a way to simply tell FileMaker not to require those parenthesis while searching, that would be even easier and cleaner I suspect!

FileMaker already does not require the parentheses while searching.

Search.fp7.zip

  • Author
  • Newbies

Are you manually entering primary keys? I hope not. You should have an auto-entered key, and then a display calc field for the printing: "(" & keyfield & ")"

I had a serial number set up for the digits, and I had the parenthesis auto inserted. I took your advise about a calculation field and it worked perfectly, this also will help solve the original issue I had in searching. Now to remove the parenthesis before and after my 4 digit number, what script should I use for that? I tried a couple of different ones, but none worked as expected.

Thanks!

If this is a keyfield, any change to this value will affect all relationships that use this key. Do you have this key as a foreign key in child tables? Those will need to be changed as well.

The function to use is MiddleWords ( field ; 1 ; 1 ). You could use Replace. MAKE A BACKUP first.

this also will help solve the original issue I had in searching.

As demonstrated, there is no issue with searching. You do not need to enter the parentheses when searching.

You may want to remove the parentheses for other reasons.

The parentheses (and many other characters) are word separators.

http://help.filemaker.com/app/answers/detail/a_id/3440

So a search for (1234) is the same as a search for 1234.

  • Author
  • Newbies

All solved, I removed all of the "(" and ")" by doing a find and replace for each symbol INDIVIDUALLY. When I tried to remove both at the same time I had an unexpected result.

I can now print valid barcode labels and scan them into the search text string field of my custom dialog box without any typing. It was a really STUPID problem I created for myself by having those "(" and ")" in there! Before these modifications, FileMaker would not find any records if I did not also include the "(" and ")" that I had in my inventory number i.e. (1234) (so it would print scan-able barcodes.)

All solved, I removed all of the "(" and ")" by doing a find and replace for each symbol INDIVIDUALLY. When I tried to remove both at the same time I had an unexpected result.

I can now print valid barcode labels and scan them into the search text string field of my custom dialog box without any typing. It was a really STUPID problem I created for myself by having those "(" and ")" in there! Before these modifications, FileMaker would not find any records if I did not also include the "(" and ")" that I had in my inventory number i.e. (1234) (so it would print scan-able barcodes.)

There was no problem and FileMaker will find the data with or without the parentheses.

Using the replace command (not find/replace) would enable you to change all the data in one operation.

When using replace in this way, best to have a backup first!

Search.fp7.zip

  • Author
  • Newbies

There was no problem and FileMaker will find the data with or without the parentheses.

Using the replace command (not find/replace) would enable you to change all the data in one operation.

When using replace in this way, best to have a backup first!

Search.fp7.zip

Could you explain to me, so I understand, why was FileMaker unable to find any records unless I entered both of the () symbols?

Could you explain to me, so I understand, why was FileMaker unable to find any records unless I entered both of the () symbols?

Can you post a file that demonstrates the problem?

I have now posted two examples that clearly demonstrate that it is NOT a problem, even though the original data contains parentheses.

So I would like to see exactly what you're doing.

For instance, perhaps in find mode you were using quotes?

Here's another copy including a find dialog.

Search.fp7.zip

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.