Jump to content

Finds in other DBs


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

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 7147 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
 Share

×
×
  • Create New...

Important Information

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