Jump to content
Salesforce and other SMB Solutions are coming soon. ×

fun with the Lookup function


Recommended Posts

In FM 7, I want to do a lookup into an unrelated table and determine if a record with a unique name exists there. Say I'm on a Layout / Table Dogs and I want to allow entry of names into a table called Cats. I want to first check the Cats table and make sure that name isn't already there. (this is my effort at an illustrative example, don't take it too seriously smile.gif


Why doesn't the following solution work? I have another table of globals with a field called LookupCats. I create a relation between Globals and Cats in which LookupCats in Globals links to Name in Cats. I call this relation lookup_CatName.


If I put the fields Globals::LookupCats and lookup_CatName::Name on my Globals layout, whenever I type an existing Cat name in LookupCats, sure enough, it shows up in lookup_CatName::Name. When I enter a new cat name, lookup_CatName::Name goes blank. Looks like it works.


But in my script I put these statements:

Set Field (Globals::lookupCats ; "Fluffy")

If (Lookup_CatName::Name ; "Not Found" ) ....


I'm not expecting "Not Found" because the Name Fluffy is definitely in a record in Cats, but this lookup comes up "Not Found" every time.


What am I missing here? Am I misunderstanding something basic about the Lookup function? Is it a problem with context (because I'm running this script off a button on the Dogs Layout)?


Thanks so much for any help you can provide.

Link to comment
Share on other sites

I think the if-statement should be



set field [ your_field , "not found"]

end if



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

Terms of Use