Topic
8 replies Latest Post - ‏2012-06-27T13:03:36Z by SystemAdmin
SystemAdmin
SystemAdmin
648 Posts
ACCEPTED ANSWER

Pinned topic WQL

‏2012-06-27T11:36:41Z |
Hi All,

I have got couple of catalogs (catA, catB), where one of the attributes defined in the primary spec of catA is an attribute of type relationship with catB. Now I want to fetch all the items in catA which have got the relationship attribute having the primary key (iPK) of one of the items in catB.

I have come up something like below but it's not working. Not getting saved rather. Please suggest.

select item from catalog('catA') where item = '2007' and item = SQL(select item from catalog('catB') where item = 447)

Thanks,
Abhijeet
Updated on 2012-06-27T13:03:36Z at 2012-06-27T13:03:36Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    648 Posts
    ACCEPTED ANSWER

    Re: WQL

    ‏2012-06-27T11:39:32Z  in response to SystemAdmin
    Sorry the query is like the below.

    select item from catalog('catA') where item = '2007' and item = SQL (select item from catalog('catB') where item = 447)
  • SystemAdmin
    SystemAdmin
    648 Posts
    ACCEPTED ANSWER

    Re: WQL

    ‏2012-06-27T11:44:45Z  in response to SystemAdmin
    Hi,

    Make Item Rich Search on catA and store a result into a dynamic selection. Then open the selection and you will see WQL you need.
  • SystemAdmin
    SystemAdmin
    648 Posts
    ACCEPTED ANSWER

    Re: WQL

    ‏2012-06-27T11:51:11Z  in response to SystemAdmin
    select item from catalog('catA') where item.catalog.name = 'catB' and item.pk = '10451'
    • SystemAdmin
      SystemAdmin
      648 Posts
      ACCEPTED ANSWER

      Re: WQL

      ‏2012-06-27T11:53:59Z  in response to SystemAdmin
      
      select item from catalog(
      'catA') where item[
      'catA spec/catA spec relationship attribute'].catalog.name = catB
      ' and item['catA spec/catA spec relationship attribute
      '].pk = '10451
      '
      
      • SystemAdmin
        SystemAdmin
        648 Posts
        ACCEPTED ANSWER

        Re: WQL

        ‏2012-06-27T12:40:18Z  in response to SystemAdmin
        Thanks a ton Alexander! I did save the result as Dynamic Selection and I got what I was looking for.
        Now I need to call this selection from a JAPI, and set the pk and catalag name values from the API itself. On the other hand can I form a query in the API itself and execute it? Just like we do in Script API?

        Please suggest.

        Thanks,
        Abhijeet
        • SystemAdmin
          SystemAdmin
          648 Posts
          ACCEPTED ANSWER

          Re: WQL

          ‏2012-06-27T13:03:36Z  in response to SystemAdmin
          Of couse, you can use the WQL query of the selection as an example for creating your own WQL queries.