October 19, 200619 yr Newbies I have built a database for our departmental inventory. We do inventory each year, and as we find each item in the inventory, we have a "found" field, which we mark "yes" if "found" or "no" if we know that the item was lost or stolen during the year. (these marks are courtesy of checkboxes.) We also, regularly send items to salvage (we are an university) and would like an automated way to automatically mark items that go to salvage as being "found." I built a button to mark the items as "salvage" in the "location" field, but would now like, any items with "salvage" in the "location" field to automatically be marked "found." How on earth do I do this?
October 19, 200619 yr Okay, for the existing records: Show All Records (Ctrl + J) Go to your "found" field -- i.e. put your cursor in it. Go to the records menu Choose Replace Field Contents By Calculation Calc Is: If( Location = "Salvage" ; "Yes") In the long term -- i.e. if this isn't a once of thing, just change found to be an auto enter field that says: If( Location = "Salvage" ; "Yes" ; FoundField ) Replace field contents is on -- you'll have to make sure all the auto enter fields re-evaluate though.
October 19, 200619 yr Put a calculation in the "Found" field. Case(Location = "Salvage";"Yes"; not IsEmpty(Location);"Yes"; "No" ) Uncheck "Do not replace exisiting value" Now if you enter Salvage in location you get Found, if you enter something else, like warehouse, you get Yes and if you have nothing entered you get "No." Of course you can add or subtract from there. HTH Al
October 19, 200619 yr Hi cellojello7 and welcome to the forums. :welcomesign: You have at least two options. First, since you have a script to mark the Location of an Item as "Salvage," you can merely add another script step to set the "Found" field as "yes" ... use the Set Field script step. This may be the simplest and least invasive approach. Another method alters the "Found" field to an auto-enter calculation. In short, when "Salvage" is entered in the "Location" field, "yes" is automatically entered in the "Found" field, and it cannot be edited. When the Location is any other value, users can mark the "Found" field as "yes" or "no." It works kind of like a little switch. Attached you'll find an example file (barest of minimums) to illustrate the concept. I exercised creative license in a couple of places: • The "Found" field uses a radio button set, instead of checkboxes, to minimize the possibility of both "yes" and "no" being entered (seems one might want to prevent that from happening). • The "Location" field uses a drop-down list, instead of a script, since I couldn't accurately assume how your script may operate. Further, this may help streamline data entry. Caveat ... Since "Found" is dependent on "Location" in this scenario, there's a down-side only you can evaluate ... when Location is changed from "Salvage" to some other value, users must decide whether to edit the "Found" field. For that reason, I used a Case statement in the auto-enter calculation so you could add other criteria or "tests" that would set "yes" or "no" in the Found field. Experiment with the file and let us know if you have any questions. Hope this helps. LostandFound_01.fp7.zip
October 19, 200619 yr For something like this you really shouldn't be using a script anyway, it's kind of pointless. I suggest you really take a look at the auto enter for future use, or the replace field contents for filling in the old blanks.
Create an account or sign in to comment