Note that there are some explanatory texts on larger screens.

plurals
  1. POSome outpost result using two condition
    primarykey
    data
    text
    <p>I have to transform xml file where i should check field id '0', field id '1' and sum field id '2'. For example I have:</p> <pre><code>&lt;document&gt; &lt;line id="0"&gt; &lt;field id="0"&gt;MAR&lt;/field&gt; &lt;field id="1"&gt;doc1&lt;/field&gt; &lt;field id="2"&gt;2&lt;/field&gt; &lt;/line&gt; &lt;line id="1"&gt; &lt;field id="0"&gt;MAR&lt;/field&gt; &lt;field id="1"&gt;doc2&lt;/field&gt; &lt;field id="2"&gt;3&lt;/field&gt; &lt;/line&gt; &lt;line id="2"&gt; &lt;field id="0"&gt;AAA&gt;&lt;/field&gt; &lt;field id="1"&gt;doc4&lt;/field&gt; &lt;/line&gt; &lt;line id="3"&gt; &lt;field id="0"&gt;MAR&lt;/field&gt; &lt;field id="1"&gt;doc1&lt;/field&gt; &lt;field id="2"&gt;4&lt;/field&gt; &lt;/line&gt; &lt;/document&gt; </code></pre> <p>result should be:</p> <pre><code>&lt;type-MAR&gt; &lt;document&gt;doc1&lt;/document&gt; &lt;sum&gt;6&lt;/sum&gt; &lt;/type-MAR&gt; &lt;type-MAR&gt; &lt;document&gt;doc2&lt;/document&gt; &lt;sum&gt;3&lt;/sum&gt; &lt;/type-MAR&gt; </code></pre> <p>there I should take all MAR lines, and show some results which are depends of field id '1'.</p> <p>My idea was, first off all do cycle(for each) and use condition(when). Maybe somebody offer more omptimal decision.</p> <p>I add new note, how to check if data comes like that:</p> <pre><code>&lt;field id="0"&gt;MAR999&lt;/field&gt; &lt;field id="1"&gt;doc1-1231&lt;/field&gt; </code></pre> <p>First field i try to use function contains 'MAR', others substring-before '-'. but I stuck when I try it use on Yours program. maybe you can take some advice for it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload