Jump to content

Insert Commas before and after search string


issacd

This topic is 4798 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 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.)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This topic is 4798 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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