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
Expand all | Collapse all

error while executing xquery-statement

  • 1.  error while executing xquery-statement

    Posted Sun May 30, 2010 12:30 PM

    Hi,
    i’ve go a problem with a xquery-statment.

    my xml looks like:

    <files> 
    <file> 
    <owner></owner> 
    <name></name> 
    <size></size> 
    <extension></extension> 
    <creationTime></creationTime> 
    <lastWriteTime></lastWriteTime> 
    <lastAccessTime></lastAccessTime> 
    <path></path> 
    <parentDirectory></parentDirectory> 
    <rootDirectory></rootDirectory> 
    </file> 
    </files>

    my xquery-statement looks like:

    let $all := input()/files
    for $name in distinct-values($all/file/name/text()),
    $owner in ($all/file/owner),
    $size in ($all/file/size),
    $cTime in ($all/file/creationTime),
    $lTime in ($all/file/lastAcceessTime),
    $path in ($all/file/path)
    return (count($all[file/name=$name]), $owner, $name, $size, $cTime, $lTime, $path)

    the errormessage is:
    A runtime exception occurred. See the details for the trace.

    i don’t find any description for xplxpe0021 even in the internet nor in taminodescription.
    any idea where the fault is?

    • might there is a problem with the ressources?

    thanks for answering


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: error while executing xquery-statement

    Posted Sun May 30, 2010 04:00 PM

    the solution is us let instead of for.

    let $all := input()/files
    for $chek in ($all/file)
    let $name := distinct-values($chek/name)
    let $owner := $chek/owner
    let $size := $chek/size
    let $cTime := $chek/creationTime
    let $lTime := $chek/lastAccessTime
    let $path := $chek/path
    let $pDir := $chek/parentDirectory
    let $dir := $chek/directory
    let $pathSize := if ($pDir = 'keine Angabe') then (string-length($chek/directory))	else (string-length($chek/path))
    where ($owner = 'rwa')
    order by $pathSize ascending

    now other question.
    is there any possibility to programm an string-variable and to increase this variable?
    [in code previously with “–>”]

    
    -->  declare variable $space as xs:string := "  ";
    ...{
    let $all := input()/files
    for $chek in ($all/file)
    let $name := distinct-values($chek/name)
    let $owner := $chek/owner
    let $size := $chek/size
    let $cTime := $chek/creationTime
    let $lTime := $chek/lastAccessTime
    let $path := $chek/path
    let $pDir := $chek/parentDirectory
    let $dir := $chek/directory
    let $pathSize := if ($pDir = 'keine Angabe') then (string-length($chek/directory))	else (string-length($chek/path))
    where ($owner = 'rwa')
    order by $pathSize ascending
    return
    <tr>
    ...
    <td>{data($owner)}</td>
    {
    if (string-length($chek/rootDirectory) = string-length($chek/directory))
    -->  then (<td>{$space, data($name)}</td>)
    else (<td>{data($name)}</td>)
    -->  (: increase the variable space with two spaces :)
    -->  $space = $space + "  "
    }
    ...

    or doing with a for-loop:

    
    -->  declare variable $space as xs:integer := 0;
    ...{
    let $all := input()/files
    for $chek in ($all/file)
    let $name := distinct-values($chek/name)
    let $owner := $chek/owner
    let $size := $chek/size
    let $cTime := $chek/creationTime
    let $lTime := $chek/lastAccessTime
    let $path := $chek/path
    let $pDir := $chek/parentDirectory
    let $dir := $chek/directory
    let $pathSize := if ($pDir = 'keine Angabe') then (string-length($chek/directory))	else (string-length($chek/path))
    where ($owner = 'rwa')
    order by $pathSize ascending
    return
    <tr>
    ...
    <td>{data($owner)}</td>
    {
    -->  for (i=0, i<space>  {
    -->    $empty = ?insert i * spaces? 
    -->  }
    if (string-length($chek/rootDirectory) = string-length($chek/directory))
    -->  then (<td>{$space, data($name)}</td>)
    else (<td>{data($name)}</td>)
    (: increase the variable space with two spaces :)
    -->  $space +=2;
    }
    ...

    #webMethods
    #API-Management
    #Tamino


  • 3.  RE: error while executing xquery-statement

    Posted Mon May 31, 2010 03:18 PM

    Sorry,

    I do not really understand what you want to achieve,could you please give an example of the expected output?

    In general, recursion might be a means to achieve indentation, as variables cannot be modified in XQuery (hence the name “variable” is misleading)


    #API-Management
    #webMethods
    #Tamino