Wing Fong Posted May 5, 2003 Posted May 5, 2003 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
CobaltSky Posted May 5, 2003 Posted May 5, 2003 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.
Wing Fong Posted May 6, 2003 Author Posted May 6, 2003 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
CobaltSky Posted May 6, 2003 Posted May 6, 2003 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! ...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'.
Wing Fong Posted May 6, 2003 Author Posted May 6, 2003 Yes, I guess that was two questions. 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
CobaltSky Posted May 6, 2003 Posted May 6, 2003 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.
Recommended Posts
This topic is 7871 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 accountSign in
Already have an account? Sign in here.
Sign In Now