<?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 Script problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146206#M24802</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables, Sales Header table and a Sales Item Detail table. Both tables have invoice number with is the link between the two tables. The header file as a field noting the type of invoice (R - regular, D - debit meno, C - credit memo). The item detail table has the sales amounts, but if the header shows a C them I need to convert the amount in the detail table to a minus number. How do write the script to do this in the item detail table?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Jun 2009 01:44:00 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-06-09T01:44:00Z</dc:date>
    <item>
      <title>Script problem</title>
      <link>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146206#M24802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables, Sales Header table and a Sales Item Detail table. Both tables have invoice number with is the link between the two tables. The header file as a field noting the type of invoice (R - regular, D - debit meno, C - credit memo). The item detail table has the sales amounts, but if the header shows a C them I need to convert the amount in the detail table to a minus number. How do write the script to do this in the item detail table?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2009 01:44:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146206#M24802</guid>
      <dc:creator />
      <dc:date>2009-06-09T01:44:00Z</dc:date>
    </item>
    <item>
      <title>Script problem</title>
      <link>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146207#M24803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stephen,&lt;BR /&gt;You can use mapping:&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Header:&lt;BR /&gt;LOAD&lt;BR /&gt; InvoiceNumber,&lt;BR /&gt; InvoiceType,&lt;BR /&gt; ...&lt;BR /&gt;;&lt;BR /&gt;TypeMap:&lt;BR /&gt;MAPPING LOAD DISTINCT&lt;BR /&gt; InvoiceNumber, as A,&lt;BR /&gt; InvoiceType as B&lt;BR /&gt;RESIDENT Header:&lt;BR /&gt;//&lt;BR /&gt;ItemDetail:&lt;BR /&gt;LOAD&lt;BR /&gt; InvoiceNumber,&lt;BR /&gt; if(applymap('TypeMap', InvoiceNumber)='C', -1, 1) * SalesAmount as SalesAmount,&lt;BR /&gt;...&lt;BR /&gt;;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2009 01:53:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146207#M24803</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-09T01:53:54Z</dc:date>
    </item>
    <item>
      <title>Script problem</title>
      <link>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146208#M24804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mapping is probably the best and fastest approach, and is the approach I would probably use here. But to give you options, you could also:&lt;/P&gt;&lt;P&gt;Header:&lt;BR /&gt;LOAD&lt;BR /&gt; InvoiceNumber,&lt;BR /&gt; InvoiceType,&lt;BR /&gt; ...&lt;BR /&gt;;&lt;BR /&gt;ItemDetail:&lt;BR /&gt;LOAD&lt;BR /&gt; InvoiceNumber,&lt;BR /&gt; SalesAmount as TempSalesAmount,&lt;BR /&gt;...&lt;BR /&gt;;&lt;BR /&gt;LEFT JOIN LOAD&lt;BR /&gt; InvoiceNumber,&lt;BR /&gt; InvoiceType&lt;BR /&gt;RESIDENT Header&lt;BR /&gt;;&lt;BR /&gt;LEFT JOIN LOAD&lt;BR /&gt; InvoiceNumber,&lt;BR /&gt; if(InvoiceType='C',-1,1)*TempSalesAmount as SalesAmount&lt;BR /&gt;RESISENT ItemDetail&lt;BR /&gt;;&lt;BR /&gt;DROP FIELD TempSalesAmount&lt;BR /&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2009 03:01:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146208#M24804</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-06-09T03:01:47Z</dc:date>
    </item>
    <item>
      <title>Script problem</title>
      <link>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146209#M24805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Michael and John. I did use mapping and it is working perfectly.&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2009 04:39:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-problem/m-p/146209#M24805</guid>
      <dc:creator />
      <dc:date>2009-06-09T04:39:29Z</dc:date>
    </item>
  </channel>
</rss>

