outdoorsportz Posted March 22, 2002 Posted March 22, 2002 Hello, I have a script that I use in my "Recieving" database that does a find in another database, "Inventory", and then adjusts the levels of inventory. The problem is that when I run this script, the finds are based off of another record in the " Receiving" database. It does finds based on 3 diffenrent fields, and then sets a field in the record that is found. Why is the script jumping to another record when it runs. There is no "Go To Record" steps involved. Thanks, Steven
outdoorsportz Posted March 22, 2002 Author Posted March 22, 2002 Also, to add to my previous post. I usa almost the exact same script in other DBs to do almost the exact same thing, and have had no problems.
Fitch Posted March 24, 2002 Posted March 24, 2002 This sort of thing is often caused by a gremlin or other sort of minor demon, and is typically resolved with candles, incense, and chicken blood. However, before we begin the exorcism ceremony, it would help if you'd post the actual script. It may turn out there's a perfectly rational explanation.
outdoorsportz Posted March 25, 2002 Author Posted March 25, 2002 Hello, Here is the script: COPY [sELECT, "PRODUCT ID"] OPEN[iNVENTORY] ENTER FIND MODE GO TO FIELD["INVENTORY::PRODUCT ID"] PASTE[sELECT,"PRODUCT ID"] GO TO FIELD["SIZE"] COPY[sELECT,"SIZE"] GO TO FIELD["INVENTORY::SIZE"] PASTE[sELECT,"SIZE"] PERFORM FIND SET FIELD[iNVENTORY,"CURRENT INVENTORY","CURRENT INVENTORY + QTY"] That is the general script. I also add some other things to end the script if there are blank spaces or if the script has already been run on this record, but I only add those things after the main part of the script is working.
danjacoby Posted March 25, 2002 Posted March 25, 2002 It sounds like you're trying to put the contents of three different fields into fields in find mode in another file. Create three global fields in the "Inventory" file. Set those fields with the values you wish to find (SetField[inventory::gProductID, "value"], etc.). Then go to the Inventory file, enter find mode, set the three fields to the value in the global fields, and perform the find.
outdoorsportz Posted March 25, 2002 Author Posted March 25, 2002 I think that I have narrowed the problem down. When I use the step: GO TO FIELD[iNVENTORY, "PRODUCT ID"] by itself, it works fine. But when I add the ENTER FIND MODE step to it is does not go to the field, but stays in the current DB.
Fitch Posted March 25, 2002 Posted March 25, 2002 Steven, I highly recommend you use the method that danj. laid out. The big reason to use global fields here is that the data is still accessible when you go into Find mode. Look at your script: ...ENTER FIND MODE GO TO FIELD["INVENTORY::PRODUCT ID"] PASTE[sELECT,"PRODUCT ID"] GO TO FIELD["SIZE"] COPY[sELECT,"SIZE"]... You can't copy "SIZE" in Find mode! Uh, unless it's already a global field? In that case, never mind, you already knew all this. However, you should know, 1) You don't need to use Go To Field before a Copy or Paste, because Copy and Paste already let you specify the field, and 2) Set Field is even better, it saves an extra step, and is not dependent on the field being on the current layout. I have a sneaking suspicion that we're getting our wires crossed here... when you say GO TO FIELD[iNVENTORY, "PRODUCT ID"] are you actually talking about Go to Related Record? Because that would make sense if you put that in a script -- if you follow a GTRR script step with a script step that does something in the current file, it will look like nothing happened -- the related file is actually displaying the related records, but you don't see them because you're still in the current file. Also, I'm wondering if part of your script is referencing a script in the Inventory file? It's not completely clear to me. Again, as danj. said, that's probably the best way to do it, perform the Find in the Inventory file.
outdoorsportz Posted March 25, 2002 Author Posted March 25, 2002 I tried the solution of using global fields, and that seems to work. It also seems like a better solution than the one that I had thought up. Thanks
outdoorsportz Posted March 28, 2002 Author Posted March 28, 2002 So I have one more little problem. The finds using global fields works great. After I perform the find, I use a "set field" to modify a found record. The results of the find are always such that only one record is found, and I want to set a field in that found record. When I perform this script, the finding part works great, but another record is affected by the "set field". This record is not among the found set, and my script only consists of a "set field" after the find. Why would this happen?
Fitch Posted March 29, 2002 Posted March 29, 2002 The way to figure this out is to insert some Pause Script steps in your script, then print out the script so you can check off each pause with a #2 pencil as the script runs, and make sure what you think is happening is not merely an illuuuuusion. You are getting sleeeeepy...
Recommended Posts
This topic is 8279 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