Use your find criterion as a script parameter as well. That way if no record is found, create a new one and use SetField with Get(Script Parameter).
Thanks Rick... but I'm really dumb on this i'm not sure what you mean
Does this mean that I start a new script and add that into another script?
Sorry I am so dumb on this... i'm trying to make it easy for someone else to enter data..... I can do it without scripts!!!
I've become quite the script-aholic and can pretty much write one that reads as a short story in my sleep. I'd need some more information though before I can help.
So, you want to Perform Find, and then if no Records found, create a new record based on the Find criteria entered?
If my understanding is correct, a proposed solution would depend on a number of factors ... How many fields are being searched? Is it only for the one layout?
thanks for helping out here
I am only searching on one field ..... Part number which is unique to each rrecordist is for only one layout.
so what is happening is that we are unpacking and cataloging and putting away stock of electrical parts for classic cars.
unfortunately the stock which I bought as a bulk lot (800 tea chest size boxes) is not all together and I also have many parts already in the system (over 6500 records)
sometimes I need to search on a model number...... But that's not an issue as I just go to table view..... And add or change from tthere chthanks dannythanks danny
Define a global field, YourTable::gPartNumber Search. Enter your part number into this field, then perform the following script:
Enter Find Mode 
Set Field [YourTable::partNumber ; YourTable::gPartNumberSearch ]
Set Error Capture [on]
Perform Find 
If [ Get ( FoundCount ) = 0 ]
Set Field [ YourTable::PartNumber ; YourTable::gPartNumberSearch ]
I have tried this but cannot get setfield to have 2 fields in it
and where do I put the number I want...in Partnumber?
and where do i attach the script
Danny, when you edit the script, click on your Set Field Script Step. On the bottom right of the screen (in FM PRO 12) are 2 "specify' windows. They will populate your script.
Danny, you can create a button that uses a dialog box to enter data into the gfield then runs the rest of the script as posted above which might look like ―
Show Custom Dialog [ "Enter Part # to Find" ; YourTable::gPartNumberSearch ]
or, you can add the Field onto your layout and then use add the script as a Trigger Script on Object Exit
You may want to add a script step at the end to clear the field, but that's just what I'd do ―
Set Field [ YourTable::gPartNumberSearch ; "" ]
When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.
Thanks guys and gal
i will try all of this today..... Have to go out thismorning
you guys are legends !
Ok well I have it working now Many Thanks to you all
Denise I used the reset and also a dialog box.... never used before great!!
I ave just one more thing to do...... If a record is found then go to field "qty"
however if it is a new record then I want it to go to a field "major category"
So I added the command .... no matter where i put in the script it only goes to the last feild i nominate
can you help here please
oops....... fixed it error in syntax !!!
Many Thanks again