<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Xpath to use alternate element value if preferred value is nilled in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323210#M93083</link>
    <description>&lt;P&gt;Finally solved it after about 4 hours...&lt;/P&gt;&lt;PRE&gt;concat(substring(PaymentDate,   1 div    (boolean(PaymentDate) and PaymentDate!='')),
       substring(AccountingDate,1 div not(boolean(PaymentDate) and PaymentDate!='')))&lt;/PRE&gt;&lt;P&gt;(It also caters for the possibility that PaymentDate doesn't exist at all although in my case it always does.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I just need to make it work with three possible dates!&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2018 13:18:32 GMT</pubDate>
    <dc:creator>alevy</dc:creator>
    <dc:date>2018-01-25T13:18:32Z</dc:date>
    <item>
      <title>Xpath to use alternate element value if preferred value is nilled</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323209#M93082</link>
      <description>&lt;P&gt;I'm receiving XML as follows:&lt;/P&gt;
&lt;P&gt;&amp;lt;Events&amp;nbsp;xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;EventDetails&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;AccountingDate&amp;gt;2017-01-01&amp;lt;/AccountingDate&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PaymentDate&amp;gt;2017-01-31&amp;lt;/PaymentDate&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/EventDetails&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;EventDetails&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PaymentDate&amp;gt;2017-01-31&amp;lt;/PaymentDate&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;AccountingDate&amp;gt;2017-01-01&amp;lt;/AccountingDate&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/EventDetails&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;EventDetails&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;AccountingDate&amp;gt;2017-01-01&amp;lt;/AccountingDate&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PaymentDate xsi:nil="true"/&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/EventDetails&amp;gt;&lt;BR /&gt;&amp;lt;/Events&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to extract the PaymentDate if it exists but otherwise substitute the AccountingDate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone please help with an Xpath expression that will achieve this for me? (It must be done in the Xpath rather than after the tExtractXMLfield component as the actual parsing logic is externally sourced.)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 11:29:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323209#M93082</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2018-01-25T11:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Xpath to use alternate element value if preferred value is nilled</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323210#M93083</link>
      <description>&lt;P&gt;Finally solved it after about 4 hours...&lt;/P&gt;&lt;PRE&gt;concat(substring(PaymentDate,   1 div    (boolean(PaymentDate) and PaymentDate!='')),
       substring(AccountingDate,1 div not(boolean(PaymentDate) and PaymentDate!='')))&lt;/PRE&gt;&lt;P&gt;(It also caters for the possibility that PaymentDate doesn't exist at all although in my case it always does.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I just need to make it work with three possible dates!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 13:18:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323210#M93083</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2018-01-25T13:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Xpath to use alternate element value if preferred value is nilled</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323211#M93084</link>
      <description>&lt;PRE&gt;Is that an XPath query ?"concat(substring(PaymentDate,   1 div    (boolean(PaymentDate) and PaymentDate!='')),
       substring(AccountingDate,1 div not(boolean(PaymentDate) and PaymentDate!='')))"&lt;/PRE&gt;&lt;P&gt;is there any way that we can join multiple fields in a different loop from same XML file ?&amp;nbsp; to get the desired out put ?&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jan 2018 03:53:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323211#M93084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-28T03:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Xpath to use alternate element value if preferred value is nilled</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323212#M93085</link>
      <description>&lt;P&gt;Yes, it is.&lt;/P&gt;&lt;P&gt;You should post a new question, with example of&amp;nbsp;your XML&amp;nbsp;and&amp;nbsp;the result&amp;nbsp;you want to achieve.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jan 2018 03:59:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323212#M93085</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2018-01-28T03:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Xpath to use alternate element value if preferred value is nilled</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323213#M93086</link>
      <description>&lt;P&gt;Glad to see you back Adam!&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Elisa&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 08:43:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Xpath-to-use-alternate-element-value-if-preferred-value-is/m-p/2323213#M93086</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-29T08:43:37Z</dc:date>
    </item>
  </channel>
</rss>

