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

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

    Re: WQL

    ‏2012-06-27T11:39:32Z  
    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

    Re: WQL

    ‏2012-06-27T11:40:19Z  
    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)
    can't help it's not getting posted properly.

    ~Abhijeet
  • SystemAdmin
    SystemAdmin
    648 Posts

    Re: WQL

    ‏2012-06-27T11:44:45Z  
    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

    Re: WQL

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

    Re: WQL

    ‏2012-06-27T11:51:59Z  
    can't help it's not getting posted properly.

    ~Abhijeet
    Use code tag top post such text
  • SystemAdmin
    SystemAdmin
    648 Posts

    Re: WQL

    ‏2012-06-27T11:53:59Z  
    select item from catalog('catA') where item.catalog.name = 'catB' and item.pk = '10451'
    
    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

    Re: WQL

    ‏2012-06-27T12:40:18Z  
    <pre class="jive-pre"> 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 ' </pre>
    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

    Re: WQL

    ‏2012-06-27T13:03:36Z  
    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
    Of couse, you can use the WQL query of the selection as an example for creating your own WQL queries.