TIBCO XPath Tips

Comment

{-- comment --}

starts-with

scenario: check if any value of “numberPrefix” element starts with a specific value

GetNumberList:

<root>
  <numberPrefix>...</numberPrefix>
  <numberPrefix>...</numberPrefix>
……
</root>
count($GetNumberList/root[numberPrefix[starts-with(., 'Valid Value')]]) > 0

Subtract Map

(取出不存在Result List的accountNumber)

$Start/root/accountInfo/accounts[not(accountNumber=$Result/accounts/accountNumber)]

sum

(計算dueDate<=前一天的amount總和)

sum($invoice/invoiceInfos/InvoiceInfo[dueDate[tib:compare-dateTime(.,tib:add-to-dateTime(current-dateTime(),0,0,-1,0,0,0))<=0]]/amount)

Extract Node without Namespaces

<xsl:value-of select="*:Envelope/*:Body/*:user/*:name"/>

Sort

在 for-each→點選Add Child→Statement Type: Sort→設定 Ordering, Data-Type…→Ok

Remove duplicate Data

Method 1: Using Grouping

http://tutorialspedia.com/tibco-for-each-group-tutorial-removing-duplicate-data/

Method 2: Sort→Using position(), 取第一筆及所有與前一筆不同的資料 (以此來去除重覆值)

$idx = position()
($idx=1) or (current()/XXX != $sort/...[$idx - 1]/XXX)

Reference

http://tibco-middleware.blogspot.tw

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s