0

I have the following NSManagedObjects:

Product <<->> ProductAttribute <->> ProductAttributeOption

What's the correct way for using an NSPredicate to fetch the ProductAttributeOptions based on the product?

I've tried the following without luck:

[NSPredicate predicateWithFormat:@"ANY SELF.productAttribute.products MATCHES %@", product]

[NSPredicate predicateWithFormat:@"ANY SELF.productAttribute@distinctUnionOfSets.products MATCHES %@"", product]

[NSPredicate predicateWithFormat:@"ANY SELF.productAttribute.@distinctUnionOfSets.giftProducts LIKE[cd] %@", self.giftProduct]

Any advice? Thanks!


Spinner converter android

I am having some confusion with the spinner class in android. What I want to is make a converter, where the user picks a unit they want to convert, then in the second spinner pick the output unit. Ex Spinner 1: Yard² to Spinner 2: Feet². Im not sure how to set it up, so If yard² and feet² is selected then do this calculation. Here is the code I have so far:

         private void UnitBegin_ItemSelected (object sender, AdapterView.ItemSelectedEventArgs e)

        {
            Spinner UnitBegin = (Spinner)sender;
            string ubget = UnitBegin.SelectedItem.ToString();
            if (ubget == "Yard²")
            {
            }



        }
4

1 に答える 1

5

次の述語が機能するはずです。

[NSPredicate predicateWithFormat:@"ANY productAttribute.products = %@", product];

「MATCH」と「LIKE」は、文字列を照合するための述語で使用されます。

于 2012-10-21T09:52:13.593 に答える