webMethods

webMethods

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.  Problems using 'at'

    Posted Thu March 15, 2007 02:54 PM

    Hi,
    I have Tamino 4.4 patch 6 and the following query give me a Variable Undefined: $deal error

    
    for $contract in input()/contract return
    <contract>{
    $contract/*[not(deals)],
    <deals>{for $deal at $i in $contract/deals/deal return
    <index>{$i}</index>,
    $deal[$deal-index]/*[not(index)]
    }</deals>
    }</contract>

    Am I missing something obvious?

    Thanks

    Ryan


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: Problems using 'at'

    Posted Thu March 15, 2007 03:33 PM

    Ryan,

    sorry to answer “yes” :wink:

    your inner FLWOR expression ends at the comma, hence
    $deal[$deal-index]/*[not(index)] is outside, and $deal is not known.
    I do not know what the intended semantics is, maybe you want to add parenthesis to include this into the return clause. I changed the layout of your query to make things more obvious:

    
    for $contract in input()/contract return
    <contract>{
    $contract/*[not(deals)],
    <deals>
    {
    for $deal at $i in $contract/deals/deal return <index>{$i}</index>,
    $deal[$deal-index]/*[not(index)]
    }
    </deals>
    }</contract> 

    Maybe what you want is:

    
    for $contract in input()/contract return
    <contract>{
    $contract/*[not(deals)],
    <deals>
    {
    for $deal at $i in $contract/deals/deal 
    return (<index>{$i}</index>,
    $deal[$deal-index]/*[not(index)])
    }
    </deals>
    }</contract> 

    By the way, maybe you have to exchange $deal-index by $i

    Regards

    Harald


    #webMethods
    #API-Management
    #Tamino


  • 3.  RE: Problems using 'at'

    Posted Thu March 15, 2007 07:58 PM

    Harald,
    Wow, really not having a good day with XQuery. Thanks for the help that all works now

    Ryan


    #API-Management
    #Tamino
    #webMethods