<?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: Evaluate() function on formula in table field during load in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032784#M85100</link>
    <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;
&lt;P&gt;thank you very much for your input. My problem is, that I try to build a parameterized checklist, where the target duration for each item is depending on different parameters (sometimes up to 4 or 5) and different functions. There may also be more than one function, so building the formula for the evaluate on the fly seems really to be a bit complex.&lt;/P&gt;
&lt;P&gt;In the moment, I loop through my table, because it has less than 100 datasets, so the loop takes nearly no time. Then I can read the formula for each dataset into a variable and "execute" the formula during another load.&lt;/P&gt;
&lt;P&gt;Not very elegant, but it works. If you have another idea how to solve such a problem in a more elegant way, I will be very happy for your input.&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;&lt;BR /&gt;Dirk&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2023 12:57:15 GMT</pubDate>
    <dc:creator>dirk_fischer</dc:creator>
    <dc:date>2023-02-01T12:57:15Z</dc:date>
    <item>
      <title>Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032575#M85081</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;
&lt;P&gt;I struggle with the attached load script, which is not working as expected although I tried to base it upon the example in the online help.&lt;/P&gt;
&lt;P&gt;For some reason the Evaluate(FORMULA) returns 0 for the first line and Null for all following lines, so it looks like it does not evaluate the content of the field FORMULA as proper formula.&lt;/P&gt;
&lt;P&gt;TEST:&lt;BR /&gt;Load&lt;BR /&gt;Evaluate(FORMULA) As EVALUATED,&lt;BR /&gt;*&lt;BR /&gt;Inline [FORMULA, FIELD01, FIELD02&lt;BR /&gt;'RangeSum(FIELD01, FIELD02)', 1, 2&lt;BR /&gt;'RangeMax(FIELD01, FIELD02)', 1, 2&lt;BR /&gt;'RangeMin(FIELD01, FIELD02)', 1, 2&lt;BR /&gt;FIELD01 * 3, 1, 2&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anybody have an idea, what is wrong in this code? Or is this a limitation of the Evaluate() function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dirk&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 06:33:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032575#M85081</guid>
      <dc:creator>dirk_fischer</dc:creator>
      <dc:date>2023-02-01T06:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032780#M85099</link>
      <description>&lt;P&gt;I think the reason why it didn't work is that the specified fields within FORMULA remain strings within the evaluate() and aren't taken as field-reference. This means you need a more complex data-structure with more or less efforts (conditions) to combine the parts properly. The following worked and demonstrate what's meant:&lt;/P&gt;
&lt;P&gt;TEST:&lt;BR /&gt;load *, evaluate(if(len(Function), Function &amp;amp; Parameter1 &amp;amp; ', ' &amp;amp; Parameter2 &amp;amp; ')', Parameter1 &amp;amp; Operator &amp;amp; Parameter2)) as X;&lt;BR /&gt;load * inline [&lt;BR /&gt;Function, Operator, Parameter1, Parameter2&lt;BR /&gt;rangesum(, , 1, 2&lt;BR /&gt;, +, 3, 4&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;I could imagine there are easier ways to solve your task as with such evaluate() approach ...&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 12:43:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032780#M85099</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-02-01T12:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032784#M85100</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;
&lt;P&gt;thank you very much for your input. My problem is, that I try to build a parameterized checklist, where the target duration for each item is depending on different parameters (sometimes up to 4 or 5) and different functions. There may also be more than one function, so building the formula for the evaluate on the fly seems really to be a bit complex.&lt;/P&gt;
&lt;P&gt;In the moment, I loop through my table, because it has less than 100 datasets, so the loop takes nearly no time. Then I can read the formula for each dataset into a variable and "execute" the formula during another load.&lt;/P&gt;
&lt;P&gt;Not very elegant, but it works. If you have another idea how to solve such a problem in a more elegant way, I will be very happy for your input.&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;&lt;BR /&gt;Dirk&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 12:57:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032784#M85100</guid>
      <dc:creator>dirk_fischer</dc:creator>
      <dc:date>2023-02-01T12:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032856#M85106</link>
      <description>&lt;P&gt;Just with this information it's difficult to suggest something. Thinkable would be to use a parametrized variable like:&lt;/P&gt;
&lt;P&gt;set var = "pick(match($1, 1,2,3),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rangesum(...),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rangemax(...(),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...)";&lt;/P&gt;
&lt;P&gt;and then within the load:&lt;/P&gt;
&lt;P&gt;load *, $(var(MetricID)) as Check from Source;&lt;/P&gt;
&lt;P&gt;Further possibilities may be to apply the range-functions for all measure-fields - assuming the non-relevant ones are NULL or zero and may noch impact the results - or to transform the apparently crosstable structure into a stream-data structure or ...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 14:31:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032856#M85106</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-02-01T14:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032867#M85107</link>
      <description>&lt;P&gt;Hi Marcus,&lt;BR /&gt;&lt;BR /&gt;thank you very much for your input, I will give it a try later today. But it might work in combination with what you suggested in your first response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dirk&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 14:51:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2032867#M85107</guid>
      <dc:creator>dirk_fischer</dc:creator>
      <dc:date>2023-02-01T14:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033091#M85123</link>
      <description>&lt;P&gt;G'day&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/16511"&gt;@dirk_fischer&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I had another idea of how to achieve this ...&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TEST:
Load
Evaluate(replace(replace(FORMULA,'F1',FIELD01),'F2',FIELD02)) As EVALUATED,
*
Inline [FORMULA, FIELD01, FIELD02
'RangeSum(F1, F2)', 1, 2
'RangeMax(F1, F2)', 1, 2
'RangeMin(F1, F2)', 1, 2
F1 * 3, 1, 2
];&lt;/LI-CODE&gt;
&lt;P&gt;However, I don't think it is very elegant&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_frowning_face:"&gt;🙁&lt;/span&gt;.&lt;/P&gt;
&lt;P&gt;Cheers, Barnaby.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 03:37:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033091#M85123</guid>
      <dc:creator>barnabyd</dc:creator>
      <dc:date>2023-02-02T03:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033163#M85128</link>
      <description>&lt;P&gt;Good morning Barnaby&lt;/P&gt;
&lt;P&gt;thank's a lot for this proposal. Unfortunately it does not help me, because it would mean I have to "hard-code" the replace structure with the field names. And that's something, I want to avoid.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dirk&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 07:47:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033163#M85128</guid>
      <dc:creator>dirk_fischer</dc:creator>
      <dc:date>2023-02-02T07:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033553#M85161</link>
      <description>&lt;P&gt;G'day Dirk,&lt;/P&gt;
&lt;P&gt;I think I don't have a clear idea of what your end goal is. In the final app, where are you loading the expressions from and where are the values coming from?&amp;nbsp;At some point you need to know which fields to substitute into the parameters of the functions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers, Barnaby.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 21:04:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033553#M85161</guid>
      <dc:creator>barnabyd</dc:creator>
      <dc:date>2023-02-02T21:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033674#M85172</link>
      <description>&lt;P&gt;Good morning Barnaby&lt;/P&gt;
&lt;P&gt;I build a check list for make-ready processes, where each item of the list represents a task to do during the make-ready with an individual duration. And I want to calculate a target duration, depending on parameters of the individual task (e.g. for one job you have to mount 4 printing plates, the next time 5 printing plates, so it takes longer to do it).&lt;/P&gt;
&lt;P&gt;I read the task as well as the formula for the calculation from an Excel sheet, so I read the formula at the same time as I read the task. In another application, I do the same thing and read the formula for the calculation into a variable, which is then applied to all datasets.&lt;/P&gt;
&lt;P&gt;And this is in my opinion the major difference to what I try to do for this make-ready checklist. For the make-ready checklist, I try to apply a different formula to each dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In principle it's like using a cooking recipe. If you want to feed 4 people you need 4 eggs and if you want to feed 10 people you need 10 eggs.&lt;/P&gt;
&lt;P&gt;And I have 8 different type of make-ready processes I need to create this checklist for, so hardcoding is not an option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope, this makes it a little bit clearer what I try to do, although I don't know, if there is a way to do this without looping through the datasets.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Dirk&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 06:23:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033674#M85172</guid>
      <dc:creator>dirk_fischer</dc:creator>
      <dc:date>2023-02-03T06:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033712#M85177</link>
      <description>&lt;P&gt;I think in general you could remain by your approach of defining individual expressions but not with evaluate() because like above mentioned the specified fields aren't recognized as references else treated as strings (maybe there would be ways if not complete expressions are used else combined ones from multiple string + field parts ... whereby I doubt that it would be really expedient).&lt;/P&gt;
&lt;P&gt;The essential point by each evaluation is the context where and how a statement is created and also called and here the logic could be moved to a variable which is called by another variable to include the calculation within a conditional pick-function. This may look like:&lt;/P&gt;
&lt;P&gt;t0: load *, recno() as RecNo Inline [FORMULA, FIELD01, FIELD02&lt;BR /&gt;"RangeSum(FIELD01, FIELD02)", 1, 2&lt;BR /&gt;"RangeMax(FIELD01, FIELD02)", 1, 2&lt;BR /&gt;"RangeMin(FIELD01, FIELD02)", 1, 2&lt;BR /&gt;FIELD01 * 3, 1, 2&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;t1: load concat(FORMULA, ',',RecNo) as Formula resident t0;&lt;/P&gt;
&lt;P&gt;let expr = peek('Formula', 0, 't1');&lt;BR /&gt;set var = "pick($1,$(expr))";&lt;/P&gt;
&lt;P&gt;t2: load *, $(var(RecNo)) as EVALUATED resident t0;&lt;BR /&gt;drop tables t0, t1;&lt;/P&gt;
&lt;P&gt;If within your final model the RecNo index couldn't be applied the logic could be extended to a pick(match()) to match the evaluation-type-id with the related expression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 08:07:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033712#M85177</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-02-03T08:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate() function on formula in table field during load</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033795#M85184</link>
      <description>&lt;P&gt;Marcus,&lt;/P&gt;
&lt;P&gt;this is awesome!!!&lt;/P&gt;
&lt;P&gt;It does the trick and creates exactly the result, I want to have without looping through the datasets. Great.&lt;/P&gt;
&lt;P&gt;Thank you so much for your help. I will remember this Pick function within&amp;nbsp; a parameterized variable. That's a really cool trick.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Dirk&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 10:18:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-function-on-formula-in-table-field-during-load/m-p/2033795#M85184</guid>
      <dc:creator>dirk_fischer</dc:creator>
      <dc:date>2023-02-03T10:18:14Z</dc:date>
    </item>
  </channel>
</rss>

