Are you doing a query or a calculation? WHEN would be part of a Query. Your If expression would be a calcualtion. They have two different purposes and implementation details.
In a calculation field, what you have posted should display either the value of Meta_value if meta_key = "_sku" or be empty if it is not.
But your reference to a WHERE clause suggests that you are actually trying to define a query--which isn't going to work the way you'd expect in an SQL based RDBMS instead of FileMaker.
There is, by the way, an ExecuteSQL function in FileMaker in which you can use SQL for Select queries.
I'd guess that you are trying to set up a relationship that only matches to records where the meta_key is "_sku". That would not be done with a an If function in a calculation.
Here's one way to do it, but I'm making a lot of guesses here and there are alternative options as well:
Define a calculation field in a table you want to link to the above table of data with this expression:
"_sku" and Text specified as the result type.
in Manage | Database | Relationships, drag from this field to the Meta_key field in your shadow table or table of imported ODBC data.
Now, a portal to the table of ODBC data placed on a layout based on the table where you defined the calculation field to use as a match field will list only records from the ODBC table that have _sku as the meta_key.
Thanks for the recommendation. The table I'm looking to connect to is my "Products" table. I created a new field called "WebsiteSKU", as a calculation, with simply "_sku", and stored it as text. I then related that to my imported ODBC data. (Products::WebsiteSKU <--> ODBCdata::meta_key).
Back on my products screen, I tried it in two ways:
First, I added a simple box and asked it to display the data of Products::WebsiteSKU ... which was always "_sku"
Secondly, I created a portal from the ODBCdata ... In this instance, I'm shown a huge list off all of the instances in which meta_key = _sku ... which is good, but I only want it for the one product I'm looking at. Not only that, but I'd love to be able to manipulate said value.
Forgive my lack of understanding, but perhaps a query is a better solution as my end-goal is to be able to have a field be equal to be SKU on each product. Basically I just need to map all of the ODBC data to my Filemaker tables, and that may involve a median via relationships.
Thanks for the help Phil. You seem to be the true Filemaker pro around here.
I had a response posted, but it's not here. I must have not submitted it or the "gremlins" got it or something.
You aren't limited to a single match field in a FileMaker relationship (Join).
You can match by the calculation field and by matching the value of your SKU field in Products to the Metavalue field in the ODBC data.