IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  To pass document list variables as input to the Custom/Dynamic SQL query

    Posted Mon May 15, 2006 06:31 AM

    Hi,

    Can any please advise on how we can pass the variables associated with documentlist as an input to the input variables in the custom SQL query of the JDBC Adapter service?

    for example:

    select empname, empno from emp where empno IN (%/emprecord/empno[0]%,%/emprecord/empno[1]%,%/emprecord/empno[2]%)


    #webMethods
    #Integration-Server-and-ESB
    #Adapters-and-E-Standards


  • 2.  RE: To pass document list variables as input to the Custom/Dynamic SQL query

    Posted Mon May 15, 2006 11:47 AM

    Hi,

    Can try this:
    Loop on documentlist.Inside loop docList will appear as document, then you can map input i.e (%/emprecord/empno%) to input variables in the custom SQL query.

    Regards,
    Puneet Saxena


    #Integration-Server-and-ESB
    #webMethods
    #Adapters-and-E-Standards


  • 3.  RE: To pass document list variables as input to the Custom/Dynamic SQL query

    Posted Mon May 15, 2006 04:16 PM

    Hi,
    in order to map document list to adapter service input ,as You wrote, you have to use dynamic SQL adapter service (not a custom SQL). And then use as SQL something like this:

    select empname, empno from emp where empno IN (${listOfIds})

    the adapter service during runtime, will replace ${listOfIds} with a string that you will provide, and than it will execute the query.
    So in your case, you will have to map document list to string, where each element from the list will be separated with comma, so you have to transform a list:
    1111 2222 3333

    to 1111, 2222, 3333 (it’s quite easy to do), and than pass the string “1111, 2222, 3333”, as an entry to adapter service.

    Hope this help,
    Kasper


    #Adapters-and-E-Standards
    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: To pass document list variables as input to the Custom/Dynamic SQL query

    Posted Tue May 16, 2006 06:42 PM

    You should be able to use pub.string:makeString to easily accomplish what Kasper recommended (ie. create a comma-delimited list of values.)

    CAUTION: Most databases (if not all) limit the number of arguments you can pass within an IN clause, so be careful with this approach. Consider using BETWEEN, IN (SELECT…), or a join (if possible). If you can’t come up with a different approach, you will likely have to build some type of logic to limit the number of arguments you pass to the IN clause.

    • Percio

    #webMethods
    #Integration-Server-and-ESB
    #Adapters-and-E-Standards


  • 5.  RE: To pass document list variables as input to the Custom/Dynamic SQL query

    Posted Fri September 15, 2006 03:47 PM

    I am trying to do same thing. But it is accepting ‘1111’,‘2222’,‘3333’ like this only.
    Is there anything to do , so that it can accept like “1111,2222,3333”


    #webMethods
    #Integration-Server-and-ESB
    #Adapters-and-E-Standards


  • 6.  RE: To pass document list variables as input to the Custom/Dynamic SQL query

    Posted Fri September 15, 2006 09:49 PM

    The proper sql statement is
    select empname, empno from emp where empno IN (1111,2222,3333)

    or

    select empname, empno from emp where empno IN (‘1111’,‘2222’,‘3333’)

    in the second case the values are strings.
    When I wrote “1111,2222,3333” I though about first case.
    If You will create a select like
    select empname, empno from emp where empno IN (‘1111,2222,3333’)

    then it means that row will be selected if empno equals ‘1111,2222,3333’
    Hope that it helps,
    Best regards,
    Kasper


    #Adapters-and-E-Standards
    #webMethods
    #Integration-Server-and-ESB