<?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 Set field during load to value in previous row in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/262998#M98957</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a raw data file that I am loading that has different line types.&amp;nbsp; One is the Total and another is the associated detail.&amp;nbsp; However the Detail lines do not have a reference on them, that is held on the Total Line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking to during the load if it is a Total Line set a field to the reference and then if it is a detail line set the field to the reference on the previous load line.&amp;nbsp; This accounts for variable number of detail lines as when the next Total is reached it resets the reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been able to do part of it using .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt; &lt;/SPAN&gt;if(@1=2,@15,if(@1=3,RowNo()-1)) as ref_field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sets the field for the Total line, and then if detail line gets the previous rowno().&amp;nbsp; How do I get it to populate the field with the value of ref_field from the previous rowno and not just the previous rowno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Oct 2011 10:38:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-10-20T10:38:42Z</dc:date>
    <item>
      <title>Set field during load to value in previous row</title>
      <link>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/262998#M98957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a raw data file that I am loading that has different line types.&amp;nbsp; One is the Total and another is the associated detail.&amp;nbsp; However the Detail lines do not have a reference on them, that is held on the Total Line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking to during the load if it is a Total Line set a field to the reference and then if it is a detail line set the field to the reference on the previous load line.&amp;nbsp; This accounts for variable number of detail lines as when the next Total is reached it resets the reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been able to do part of it using .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt; &lt;/SPAN&gt;if(@1=2,@15,if(@1=3,RowNo()-1)) as ref_field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sets the field for the Total line, and then if detail line gets the previous rowno().&amp;nbsp; How do I get it to populate the field with the value of ref_field from the previous rowno and not just the previous rowno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 10:38:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/262998#M98957</guid>
      <dc:creator />
      <dc:date>2011-10-20T10:38:42Z</dc:date>
    </item>
    <item>
      <title>Set field during load to value in previous row</title>
      <link>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/262999#M98958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm making the assumption that @1 = 2 identifies a Total line and = 3 identifies a detail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this in the script:&lt;/P&gt;&lt;P&gt;if (@1= 2, @15, peek('@15')) as ref_field,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 11:24:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/262999#M98958</guid>
      <dc:creator />
      <dc:date>2011-10-20T11:24:12Z</dc:date>
    </item>
    <item>
      <title>Set field during load to value in previous row</title>
      <link>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/263000#M98959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Gordon, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes @1=2 is Total and 3 is detail.&amp;nbsp; The script nearly worked, only actioned for one additional line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is a snapshot of the data.&amp;nbsp; &lt;/P&gt;&lt;P&gt;RowNo | Type | Batch Ref | Ref Field | peek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see in the ref field i have got it to change on every Type 2, and then show the previosu row number.&amp;nbsp; The peek does bring in value from previous row for @15 but it has different context on a total to detail line.&amp;nbsp; what i was looking was for it to repeat the ref field which is why i was trying to create a new ref field &lt;/P&gt;&lt;P&gt;&lt;IMG alt="capture1.bmp" class="jive-image" src="https://community.qlik.com/legacyfs/online/7997_capture1.bmp" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 11:40:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/263000#M98959</guid>
      <dc:creator />
      <dc:date>2011-10-20T11:40:52Z</dc:date>
    </item>
    <item>
      <title>Set field during load to value in previous row</title>
      <link>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/263001#M98960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Gordon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Got it, cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(@1=2,@15,peek('ref_Field)) as ref_field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 11:43:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-field-during-load-to-value-in-previous-row/m-p/263001#M98960</guid>
      <dc:creator />
      <dc:date>2011-10-20T11:43:08Z</dc:date>
    </item>
  </channel>
</rss>

