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.

2 field search - variables?

Featured Replies

Hello,

I have two fields (A and :. They contain two digits each.

I'm trying to create a script that will perform a find for any other entries that share the same values in A and B, of the entry, that the button is attached to.

For example. One entry has field A equaling 01 and field B equaling 02. I'd like the script to see and remember both values from field A and B, enter the find mode, and assign these values to the appropriate fields. I was hoping that I could set up some sort of variable to temporarly store these values, whetever they may be.

The reason why is so I could only write one scrip for this instead of specific scripts depending on what button it's attached to.

I first used a copy and paste command, but that only allows the script to remember one number.

Thanks for any suggestions.

-wing

Hello Wing,

What you're trying to do can be achieved with a single script, with the use of a global field. For example, you could script the procedure as follows:

Set Field ["gTemp_txt", "FieldA & "|" & FieldB"]

Enter Find Mode [ ]

Set Field ["FieldA", "TextToNum(LeftWords(gTemp_txt, 1))"]

Set Field ["FieldB", "TextToNum(RightWords(gTemp_txt, 1))"]

Perform Find [Replace Found Set]

This technique requires only one global field (a text field), but of course you could use two separate global fields (number fields) if you'd prefer. wink.gif

  • Author

Great, I'm gonna give it a shot.

One question: Do I need to define that global field first? And if so, do I also need to physically put it on all the layouts?

Thanks!

-wing

Great, I'm gonna give it a shot.

One question: Do I need to define that global field first? And if so, do I also need to physically put it on all the layouts?

Thanks!

-wing

Umm... that's two questions! smile.gifsmile.gif ...so here's two answers:

1. Yes, you will need to define the global field first, before creating the script.

2. No, the global field doesn't need to appear on any layouts, it will operate 'behind the scenes'.

  • Author

Yes, I guess that was two questions. smile.gif

I couldn't get your script to work, but I used the theory and just made two fields for each. I then had a problem, I think, because I was using numbers like "01" and the zero in front was causing problems, and or my field definitions should have been "number" not "text".

But, I worked it out.

Thanks for the help!

-wing

I'm afraid I made the assumption that your fields were number fields - which as it turns out was not correct.

That being the case, the script I outlined did not require the inclusion of the TextToNum( ) functions - it would have worked correctly without them.

Notwithstanding that, I'm glad to hear that you got your problem solved. wink.gif

Create an account or sign in to comment

Important Information

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

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.