<?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 How can I use variable data in QV? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-can-I-use-variable-data-in-QV/m-p/235108#M86397</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to create an application that will "wash" a number of files containing emailadresses so each user only gets a certain amout of newsletters per week.&lt;/P&gt;&lt;P&gt;For instance we send one general newsletter and a number of specialized newsletters per week.&lt;BR /&gt;If your profile matches all the newsletters we still only want you to receive two newsletters per week.&lt;BR /&gt;The application should look at the emailadress and the priority of the file to determine which two newsletters the emailadress should be used in.&lt;/P&gt;&lt;P&gt;The solution I have thought of means that the user would upload any number of files (and set a priority for each file).&lt;BR /&gt;( I would prefer it if there is a way that does not mean that the files needs to be loaded in the script and instead are uploaded by the end-user).&lt;/P&gt;&lt;P&gt;We have managed to create a VB script that allows the end user to select and upload files using the following code:&lt;/P&gt;&lt;P&gt;Sub LoadFile&lt;BR /&gt; 'Create and initialize variables&lt;BR /&gt; Dim oFSO, inputFile, oFile, row&lt;BR /&gt; Dim emailAddress, emailHash, tmp&lt;BR /&gt; Dim emailListVar, emailHashVar&lt;BR /&gt; Dim selection&lt;BR /&gt; Set selection = ActiveDocument.getField("FilNr").GetSelectedValues(1)&lt;BR /&gt; emailListVar = "Email_list_" &amp;amp; Selection.Item(0).Text&lt;BR /&gt; emailHashVar = "Email_hash_" &amp;amp; Selection.Item(0).Text&lt;BR /&gt; emailAddress = ""&lt;BR /&gt; emailHash = ""&lt;BR /&gt; 'Get file to read&lt;BR /&gt; inputFile = GetFileOpenDlg()&lt;BR /&gt; 'Read selected file&lt;BR /&gt; Set oFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt; If oFSO.FileExists(inputFile) Then&lt;BR /&gt; Set oFile = oFSO.OpenTextFile(inputFile, 1)&lt;BR /&gt; Do While Not oFile.AtEndOfStream&lt;BR /&gt; row = oFile.ReadLine&lt;BR /&gt; 'If row is not empty&lt;BR /&gt; If Trim(row) &amp;lt;&amp;gt; "" Then&lt;BR /&gt; tmp = Split(row, VbTab)&lt;BR /&gt; 'If neither field is empty, add to variables&lt;BR /&gt; If (Len(Trim(tmp(0))) &amp;gt; 0 And Len(Trim(tmp(1))) &amp;gt; 0) Then&lt;BR /&gt; emailAddress = emailAddress &amp;amp; Trim(tmp(0)) &amp;amp; VbCrLf&lt;BR /&gt; emailHash = emailHash &amp;amp; Trim(tmp(1)) &amp;amp; VbCrLf&lt;BR /&gt; End If&lt;BR /&gt; End If&lt;BR /&gt; Loop&lt;BR /&gt; oFile.Close&lt;BR /&gt; 'Set QV-variables with the file contents&lt;BR /&gt; ActiveDocument.GetVariable(emailListVar).SetContent emailAddress, true&lt;BR /&gt; ActiveDocument.GetVariable(emailHashVar).SetContent emailHash, true&lt;BR /&gt; MsgBox(emailAddress)&lt;BR /&gt; MsgBox(emailHash)&lt;BR /&gt; End If&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;When I look in my application (for instance create a listbox with the following expression =&lt;B&gt;&lt;I&gt;Email_list_1, then I can see that the emailadresses are there.&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;I&gt;My problem is that I can not find a way to work with the data.&lt;BR /&gt; If the data was loaded via the script I would be able to create logic that would give me which emailadresses should go in which files.&lt;/I&gt;&lt;/B&gt; &lt;B&gt;&lt;I&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;Anyone know how to get the variable data into i field in qv?&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;br&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Apr 2011 12:39:39 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-04-29T12:39:39Z</dc:date>
    <item>
      <title>How can I use variable data in QV?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-variable-data-in-QV/m-p/235108#M86397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to create an application that will "wash" a number of files containing emailadresses so each user only gets a certain amout of newsletters per week.&lt;/P&gt;&lt;P&gt;For instance we send one general newsletter and a number of specialized newsletters per week.&lt;BR /&gt;If your profile matches all the newsletters we still only want you to receive two newsletters per week.&lt;BR /&gt;The application should look at the emailadress and the priority of the file to determine which two newsletters the emailadress should be used in.&lt;/P&gt;&lt;P&gt;The solution I have thought of means that the user would upload any number of files (and set a priority for each file).&lt;BR /&gt;( I would prefer it if there is a way that does not mean that the files needs to be loaded in the script and instead are uploaded by the end-user).&lt;/P&gt;&lt;P&gt;We have managed to create a VB script that allows the end user to select and upload files using the following code:&lt;/P&gt;&lt;P&gt;Sub LoadFile&lt;BR /&gt; 'Create and initialize variables&lt;BR /&gt; Dim oFSO, inputFile, oFile, row&lt;BR /&gt; Dim emailAddress, emailHash, tmp&lt;BR /&gt; Dim emailListVar, emailHashVar&lt;BR /&gt; Dim selection&lt;BR /&gt; Set selection = ActiveDocument.getField("FilNr").GetSelectedValues(1)&lt;BR /&gt; emailListVar = "Email_list_" &amp;amp; Selection.Item(0).Text&lt;BR /&gt; emailHashVar = "Email_hash_" &amp;amp; Selection.Item(0).Text&lt;BR /&gt; emailAddress = ""&lt;BR /&gt; emailHash = ""&lt;BR /&gt; 'Get file to read&lt;BR /&gt; inputFile = GetFileOpenDlg()&lt;BR /&gt; 'Read selected file&lt;BR /&gt; Set oFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt; If oFSO.FileExists(inputFile) Then&lt;BR /&gt; Set oFile = oFSO.OpenTextFile(inputFile, 1)&lt;BR /&gt; Do While Not oFile.AtEndOfStream&lt;BR /&gt; row = oFile.ReadLine&lt;BR /&gt; 'If row is not empty&lt;BR /&gt; If Trim(row) &amp;lt;&amp;gt; "" Then&lt;BR /&gt; tmp = Split(row, VbTab)&lt;BR /&gt; 'If neither field is empty, add to variables&lt;BR /&gt; If (Len(Trim(tmp(0))) &amp;gt; 0 And Len(Trim(tmp(1))) &amp;gt; 0) Then&lt;BR /&gt; emailAddress = emailAddress &amp;amp; Trim(tmp(0)) &amp;amp; VbCrLf&lt;BR /&gt; emailHash = emailHash &amp;amp; Trim(tmp(1)) &amp;amp; VbCrLf&lt;BR /&gt; End If&lt;BR /&gt; End If&lt;BR /&gt; Loop&lt;BR /&gt; oFile.Close&lt;BR /&gt; 'Set QV-variables with the file contents&lt;BR /&gt; ActiveDocument.GetVariable(emailListVar).SetContent emailAddress, true&lt;BR /&gt; ActiveDocument.GetVariable(emailHashVar).SetContent emailHash, true&lt;BR /&gt; MsgBox(emailAddress)&lt;BR /&gt; MsgBox(emailHash)&lt;BR /&gt; End If&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;When I look in my application (for instance create a listbox with the following expression =&lt;B&gt;&lt;I&gt;Email_list_1, then I can see that the emailadresses are there.&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;I&gt;My problem is that I can not find a way to work with the data.&lt;BR /&gt; If the data was loaded via the script I would be able to create logic that would give me which emailadresses should go in which files.&lt;/I&gt;&lt;/B&gt; &lt;B&gt;&lt;I&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;Anyone know how to get the variable data into i field in qv?&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;br&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 12:39:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-variable-data-in-QV/m-p/235108#M86397</guid>
      <dc:creator />
      <dc:date>2011-04-29T12:39:39Z</dc:date>
    </item>
  </channel>
</rss>

