You need a loop.
1. Go to Layout
2. Perform your find
3. Go to record/Request (first)
5. do all the stuff you need to do with this record
6. Go to Record/Request (next;exit after last)
7. end loop
8. do whatever else you need to do.
Above is a rough description of what you need to do, not exact syntax, but it should get you where you need to go. You should consider using Set Variable coupled with Set Field instead of copying and pasting.
I think I've posted this before....
I wouldn't create and delete records like this at all. There's a simpler, safer approach.
Make one table with a status field that records something like "IN" or "Out".
To check out an item change the field to Out. To check it in, do the opposite.
To see a list of all items in stock, do a find for all records with "IN" in the status field.
To see alist of all items checked out, do a find for all records with "Out" in the status field.
Thank you for the quick reply.
I tried inserting loop, however, it seemed to be almost infinite....am I missing something?
Where should I put the loop in the script and where should I end it?
I absolutely need two separate inventories, you are correct when you said you answered this, however, at the time, I did not have a correct script to utilize, whereas now I do, I'm just asking what I need to have this script run for multiple records at a time.
Sorry for the miscommunication, I'm trying my hardest to be clear.
Phil's approach is the way to go. In addition to the In/Out status field, you could have an "out timestamp" field and an "in timestamp" field. I.e. you create a record each time an item goes out, then when it comes in, you change the status and set the in timestamp. (Or you can use separate date and time fields if needed.)
Regarding the copy/paste script as posted, one option would be to simply import the found records into the other table.
Another option, and a very useful technique to learn, is to use Set Variable to grab each field you need, then Set Field to go from the variable into the new record:
Set Variable [ $type ; Type of Equipment ] Set Variable [ $id ; Serial Number ] Go to Layout ["Issued Equipment Inventory" ] New Record/Request Set Field [ Equipment Model ; $type ] Set Field [ Serial Number ; $id ]
The Loop could look like this:
## assumes you start with a found set of records to DELETE
Go to Layout ["Available to Distribute"]
Exit Loop If[ Get( FoundCount ) = 0 ]
Set Variable [ $type ; Type of Equipment ]
Set Variable [ $id ; Serial Number ]
Go to Layout ["Issued Equipment Inventory"]
Set Field [ Equipment Model ; $type ]
Set Field [ Serial Number ; $id ] End Loop
You sent me a Private Message that fills in a lot more detail on your needs. Feel free to post an edited version of your PM here for others to comment on. Since your PM mentions that you are issuing multiple copies of the same item, I'd actually modify my approach futher to use an Inventory Log system where you log each change as a separate record in the log and use summary fields to compute the current total on hand.
Since an item can be either returned or lost/destroyed/used up. You might need an extra field to document which items are no longer returnable in order to accurately report how many items are "out" as opposed to how many items are "Used Up".
As I suggested in my Private Message Reply, a search of this forum for "Inventory Log" can pull up several discussions that describe this approach in more detail.
I agree with Phil's approach. However, if you use a loop there must be a condition set to trigger ending the loop. Given the loop is acting on your found set, which would be finite, the Go to Record/Request (next,with"EXIT AFTER LAST"checked) should cause the loop to stop once you've reached the last record in the set. Also the suggestion of exiting the loop if Get(FoundCount)=0 would work if you're deleting records. I'll re-read your original post, but to me this seems like this method is not the best.