<?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 Re: user defined function issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744104#M1038032</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;one possible solution could be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_147527_Pic1.JPG" class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/74722_QlikCommunity_Thread_147527_Pic1.JPG" style="height: 318px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_147527_Pic3.JPG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/74733_QlikCommunity_Thread_147527_Pic3.JPG" style="height: 252px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_147527_Pic2.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/74732_QlikCommunity_Thread_147527_Pic2.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14205866934262342" jivemacro_uid="_14205866934262342"&gt;
&lt;P&gt;SET vRel2AbsHum = 0.622*$1*2337/(101300-$1*2337);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;tabHumidity:&lt;/P&gt;
&lt;P&gt;LOAD Dual(RecNo()&amp;amp;' RH%', RecNo()) as rel.hum&lt;/P&gt;
&lt;P&gt;AutoGenerate 100;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&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;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Jan 2015 23:25:19 GMT</pubDate>
    <dc:creator>MarcoWedel</dc:creator>
    <dc:date>2015-01-06T23:25:19Z</dc:date>
    <item>
      <title>user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744100#M1038026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first off all I am quite new to the QlikView Community and still only have a basic knowledge in the use of QlikView. I am reading temperature and humidity data from a database. I can show all the values in diagramms and so on, no problem. But now I want to create a user defined function to calculate the total amount of water in the air. Therefore I have a formular:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0.622 * (rel. hum * saturated vapour pressure) / (air pressure - rel. hum * saturated vapour pressure)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To test the function I use a fix value for saturated vapour pressure at 20°C = 2337&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I built following function in QlikView: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0.622 &amp;amp; '*' &amp;amp; (Only({$} $1) &amp;amp; '*' &amp;amp; 2337) &amp;amp; '/' &amp;amp; (101300 &amp;amp; '-' &amp;amp; Only({$} $1) &amp;amp; '*' &amp;amp; 2337) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to use this function in a diagramm, so that for every value of a dimension the function Only() picks its value. But it doesn't work &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt; How can i fix this? I would be very happy about any help! Thanks a lot. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Henrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 21:16:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744100#M1038026</guid>
      <dc:creator />
      <dc:date>2015-01-06T21:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744101#M1038027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please post sample data/app&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 22:24:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744101#M1038027</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-01-06T22:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744102#M1038028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How and where do you call your user-defined function? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 22:41:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744102#M1038028</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-01-06T22:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744103#M1038031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Only(fieldname)&amp;nbsp; will return a value if the field has just one selected value. If the field has more than one value selected then only(fieldname) will return null.&lt;/P&gt;&lt;P&gt;Thus your expression will return null unless every field value is filtered to only select a single value&amp;nbsp; - not what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should be able to use&amp;nbsp; a similar expression to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.622 * (rel. hum * saturated vapour pressure) / (air pressure - rel. hum * saturated vapour pressure)&lt;/P&gt;&lt;P&gt;directly in the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply substitute each item such as "rel. hum", "saturated vapour pressure" etc, with the field names that hold the data.&lt;/P&gt;&lt;P&gt;You do not need to create a user defined function, just create an expression in your chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you post some example data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 22:44:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744103#M1038031</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2015-01-06T22:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744104#M1038032</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;one possible solution could be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_147527_Pic1.JPG" class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/74722_QlikCommunity_Thread_147527_Pic1.JPG" style="height: 318px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_147527_Pic3.JPG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/74733_QlikCommunity_Thread_147527_Pic3.JPG" style="height: 252px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_147527_Pic2.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/74732_QlikCommunity_Thread_147527_Pic2.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14205866934262342" jivemacro_uid="_14205866934262342"&gt;
&lt;P&gt;SET vRel2AbsHum = 0.622*$1*2337/(101300-$1*2337);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;tabHumidity:&lt;/P&gt;
&lt;P&gt;LOAD Dual(RecNo()&amp;amp;' RH%', RecNo()) as rel.hum&lt;/P&gt;
&lt;P&gt;AutoGenerate 100;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&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;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 23:25:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744104#M1038032</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-01-06T23:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744105#M1038033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it's an expression that takes parameters and parameters are identified by their position using $1, $2 etc.&lt;/P&gt;&lt;P&gt;check Marco reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jagan uses it in this thread.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-3836"&gt;Calculating Months difference between two dates&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 23:47:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744105#M1038033</guid>
      <dc:creator />
      <dc:date>2015-01-06T23:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744106#M1038034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IN LOAD SCRIPT WRITE:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SET YourFomulaName= Num(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;0.622 * ( $1&amp;nbsp; *&amp;nbsp; $2 )&amp;nbsp;&amp;nbsp; / (($3-&amp;nbsp; $1)&amp;nbsp; * $2));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; color: #3d3d3d; font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; color: #3d3d3d; font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Let's say your dimension's name is RELHUM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; color: #3d3d3d; font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;then in the expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; color: #3d3d3d; font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;=$(YourFormulaName(RELHUM,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;2337,101300))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Note: no need for {$} as it implies the current selection by default.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;check this thread&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;A href="https://community.qlik.com/docs/DOC-3836"&gt;Calculating Months difference between two dates&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 00:25:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744106#M1038034</guid>
      <dc:creator />
      <dc:date>2015-01-07T00:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744107#M1038035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try chaining it:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;saturated vapour pressure&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;=$(YourFormulaName(RELHUM,=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;$(VapPress(Temp)),101300))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 00:27:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744107#M1038035</guid>
      <dc:creator />
      <dc:date>2015-01-07T00:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744108#M1038036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first of all I would like to thank you for all the responses. I reviewd the different methods to achieve my goal. Finally I used this function and it worked as I wanted: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET udf_water_content = Num(0.622*($1*$2)/(($3-$1*$2)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now I sure want to get the saturated vapour pressure of the measured temperature. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;water_content = $(udf_water_content(humidity,=$(VapPress(=$(round(temperature))),101300));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table with temperatures from -20 to 99 °C with the associated saturated vapour pressures. So how can I define the VapPress function to select the vapour pressure of the associated temperature? Attached you can see the table with the preassures. And not to forget: The meassured temperatures are floats, so I would need ro round them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="table.png" class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/74835_table.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all following replys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Henrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 12:56:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744108#M1038036</guid>
      <dc:creator />
      <dc:date>2015-01-08T12:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: user defined function issue</title>
      <link>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744109#M1038037</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;please close this thread by selecting an answer that solved your problem and open another thread for your new question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&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;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 13:27:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/user-defined-function-issue/m-p/744109#M1038037</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-01-08T13:27:02Z</dc:date>
    </item>
  </channel>
</rss>

