Clarity

 View Only
  • 1.  WSDL IN filtering not working in Query API

    Posted Apr 24, 2012 08:59 AM
    I have been using IN filters on the Query API. this used to work fine on some versions of 12, but does not work on 13 :-(
    Below is the call that i have made for this query api call in the past, and it works fine on v 12.1, but not on 13.
    <quer:SessionID>xxxxxxxx</quer:Sess
    ionID>
    </quer:Auth>
    </soapenv:Header>
    <soapenv:Body>
    <quer:Query>
    <quer:Code>test</quer:Code>
    <quer:Filter>
    <quer:project_name_in>project1,project2</quer:project_name_in>
    </quer:Filter>
    </quer:Query>
    </soapenv:Body>
    </soapenv:Envelope>


    If anyone knows a decent workaround for this (how to pass multiple parameters separated by comma to a query)
    I think there is a bug in Clarity CLRT-54839 .
    Any assistance on a workaround would be great.
    thanks
    Federico


  • 2.  RE: WSDL IN filtering not working in Query API

    Posted Apr 25, 2012 06:03 AM
    Hi Federico,

    I believe this originates from a support issue I have been assisting with this past week.

    In that, we logged a defect for the behaviour, but it isn't related to CLRT-54839. The one we logged for this is CLRT-67899.

    The workaround I provided for this, was to take advantage of an enhancement request in 12.1.2 and above that gives a secondary method for WSDL query filtering on selective parameters. It requires a change to both the query and the SOAP request you're sending.

    In the WHERE clause of your query, you would add a condition like this:

    AND inv.name in (@WHERE:PARAM:USER_DEF:STRING_LIST:projnamelist@)

    (Note the data type _LIST here is what enables this capability).

    Then in the SOAP request you would replace your filter with one like this:

    <quer:param_projnamelist>project1,project2</quer:param_projnamelist>

    As is, that would be fine, but there is a difference in behaviour to the filter it replaces because it makes it required in the query in order for it to work, if you don't supply this filter, then you get no results (instead of all as before).

    If you also want it to provide all results when no filter is supplied, the WHERE clause in the query needs to instead be able to check when the parameter maybe a comma separated list or a single null value, like this:

    AND (inv.name in (@WHERE:PARAM:USER_DEF:STRING_LIST:projnamelist@) OR
    greatest(@WHERE:PARAM:USER_DEF:STRING_LIST:projnamelist@) is null)

    This is OK for Oracle systems and now without the filter in the SOAP request, you would get all results as normal, and with the filter, just the results you desire. SQL Server does not natively support the greatest() function though and so some other alternative function that accepts any number of input parameters and chooses one is needed instead.

    Please note that there is no in suffix to the SOAP request filter parameter, and that it works with both single value or multi-value (comma separated) filter entries.  It is prefixed with param though, as are other @WHERE:PARAM:...@ NSQL construct parameters.

    The drawback with this method of course is that you have to add a WHERE clause entry like this to the query for each parameter you want to filter on, but as a workaround it may suffice where absolutely needed until the defect can be corrected again.


  • 3.  RE: WSDL IN filtering not working in Query API

    Posted Apr 26, 2012 07:55 AM
    Hi Nick,
    we must be helping the same person. although i have several clients that have this issue. Unfortunately your workaround does not work. only works for SINGLE records, does not work for multiple records separated by a comma.
    I did test that yesterday, and XOG blows up when you try to separate the values as commas.
    I appreciate your assistance.
    Just an FYI, it occurs in 13 as well.
    Now that i have the ticket number, you will get a few more requests this week.
    Thanks


  • 4.  RE: WSDL IN filtering not working in Query API

    Posted Apr 26, 2012 08:20 AM
    On the issue, the query that was used looks to be incorrectly formed.

    It logged an error like this (values have been generalised):

    Error message: [CA Clarity][Oracle JDBC Driver][Oracle]ORA-00920: invalid relational operator
    ...
    WHERE inv.odf_object_code = 'project' and iv.IS_PROGRAM=0
    and inv.is_active=1
    AND 1 = 1
    AND (inv.name in ('PROJ1',' PROJ2') OR 'PROJ1',' PROJ2' is null)
    ...

    Which means the NSQL was like this:

    AND (inv.name in (@WHERE:PARAM:USER_DEF:STRING_LIST:projnamelist@) OR
    @WHERE:PARAM:USER_DEF:STRING_LIST:projnamelist@ is null)

    And you can't compare multiple values to 'is null' unless they are first rationalised to a single value, which is precisely the reason why we included the greatest() function in the example since it does:

    AND (inv.name in (@WHERE:PARAM:USER_DEF:STRING_LIST:projnamelist@) OR
    greatest(@WHERE:PARAM:USER_DEF:STRING_LIST:projnamelist@) is null)

    This then would have constructed SQL like this, which is valid on the target DBMS (Oracle):

    ...
    WHERE inv.odf_object_code = 'project' and iv.IS_PROGRAM=0
    and inv.is_active=1
    AND 1 = 1
    AND (inv.name in ('PROJ1',' PROJ2') OR greatest('PROJ1',' PROJ2') is null)
    ...

    The only other thing to be cautious about is that the white space between the commas and the values needs to be removed or else it is included as part of the condition, e.g.:

    <quer:param_projnamelist>PROJ1, PROJ2</quer:param_projnamelist>

    Would need to be correctly set as this instead:

    <quer:param_projnamelist>PROJ1,PROJ2</quer:param_projnamelist>


  • 5.  RE: WSDL IN filtering not working in Query API
    Best Answer

    Posted Aug 20, 2012 08:15 AM
    The support issues we have logged will receive the information/notification duly, but I just wanted to come back here as well to say that a fix for this (so that the workarounds shouldn't be needed anymore) can be obtained on Clarity 12.1.3 by requesting the latest generic patch for it.

    To request the patch, just log a support issue. Those already logged regarding this problem should be receiving it shortly anyway. I got the impression from this thread though that we may have other partners/customers who would benefit from knowing. Thanks.


  • 6.  RE: WSDL IN filtering not working in Query API

    Posted Aug 20, 2012 10:06 AM
    Thanks Nick,
    greatly apreciated.


  • 7.  RE: WSDL IN filtering not working in Query API

    Posted Aug 20, 2012 10:10 AM
    Nick,
    is this available for 13 as well? or just 12.0.3?


  • 8.  RE: WSDL IN filtering not working in Query API

    Posted Aug 20, 2012 10:27 AM
    It's not available yet for v13, it will come, but v12 got there first. I'll do what I can to follow up with news on the v13 front once we have it.