<?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 Assigning Variable value to Fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144125#M23165</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check if WaitForIdle() function helps. Sometimes after making selections, you should use it before proceeding further, otherwise you get erratic results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 May 2009 22:56:00 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-05-14T22:56:00Z</dc:date>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144120#M23160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an input box in which a user enters a date field which is linked to variable "Inputdate". On clicking a button 2 different date fields use this value for selection. In addition I require extra selection criteria to limit the type of records.&lt;/P&gt;&lt;P&gt;The following code is used&lt;/P&gt;&lt;P&gt;Sub DateValues&lt;/P&gt;&lt;P&gt;Set q = ActiveDocument&lt;BR /&gt;q.ClearAll (false)&lt;/P&gt;&lt;P&gt;udf=q.Variables("InputDate").GetContent.String&lt;/P&gt;&lt;P&gt;Set d1 = ActiveDocument.Fields("DATE1")&lt;BR /&gt;Set d2 = ActiveDocument.Fields("DATE2")&lt;BR /&gt;Set type = ActiveDocument.Fields("RECORD_TYPE")&lt;/P&gt;&lt;P&gt;d1.Select "*" &amp;amp; udf &amp;amp; "*"&lt;BR /&gt;d2.Select "*" &amp;amp; udf &amp;amp; "*"&lt;BR /&gt;type.Select "NEW*"&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;However only the type Selection criteria is activated - dates are ignored. Also if I try to use "=" with date variables selection is not applied correctly.&lt;/P&gt;&lt;P&gt;Could you please let me know if you can see any obvious error ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 16:00:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144120#M23160</guid>
      <dc:creator />
      <dc:date>2009-05-14T16:00:48Z</dc:date>
    </item>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144121#M23161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try to change variable name "&lt;STRONG&gt;type&lt;/STRONG&gt;" to some other name.&lt;/P&gt;&lt;P&gt;- Manish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 17:30:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144121#M23161</guid>
      <dc:creator>manishkumar75</dc:creator>
      <dc:date>2009-05-14T17:30:05Z</dc:date>
    </item>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144122#M23162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply Manish&lt;/P&gt;&lt;P&gt;I have used different names but does not seemt to resolve issue&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 17:43:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144122#M23162</guid>
      <dc:creator />
      <dc:date>2009-05-14T17:43:46Z</dc:date>
    </item>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144123#M23163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;could be something to do with the date format vs. numeric format. You can test what strings are you getting back from your variables (insert some msgbox statements for testing) and see whether it's what you are expecting.&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 22:45:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144123#M23163</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2009-05-14T22:45:08Z</dc:date>
    </item>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144124#M23164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got a macro parse error on the "set type = " field. That needs to be changed as it's probably a reserved word.&lt;/P&gt;&lt;P&gt;I had to fiddle with the data and user entry a bit, but I was able to get your sub working. It probably has to do with the format of your date fields. Have your tried a less specific entry? All of my dates are followed by 12:00:00 AM, so when I set the variable to "12", everything is selected. When I set the variable to "5/" I get everything in March or anything on the fifth day of the month.&lt;/P&gt;&lt;P&gt;In your macro, you're not comparing a date to a date, but rather a date to a string that resembles a date. Therefore, if the user enters 5/1/09, but your data says 05/01/2009, then you're not going to get any matches.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 22:46:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144124#M23164</guid>
      <dc:creator />
      <dc:date>2009-05-14T22:46:18Z</dc:date>
    </item>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144125#M23165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check if WaitForIdle() function helps. Sometimes after making selections, you should use it before proceeding further, otherwise you get erratic results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 22:56:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144125#M23165</guid>
      <dc:creator />
      <dc:date>2009-05-14T22:56:00Z</dc:date>
    </item>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144126#M23166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The mismatch between the variable type and the date is usually the problem. My suggestion for a generic approach to the problem --. always convert to date() type before selecting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;seldate = ActiveDocument.Evaluate("date(date#(vDate))")&lt;BR /&gt;ActiveDocument.GetField("DateField").Select(seldate)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The attached qvw has an example.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2009 06:02:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144126#M23166</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-05-15T06:02:56Z</dc:date>
    </item>
    <item>
      <title>Assigning Variable value to Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144127#M23167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - Formatting date seems to have resolved issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2009 13:52:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-Variable-value-to-Fields/m-p/144127#M23167</guid>
      <dc:creator />
      <dc:date>2009-05-15T13:52:47Z</dc:date>
    </item>
  </channel>
</rss>

