<?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: Maxstring not Working in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909766#M74975</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The below formula worked fine in my case:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;MaxString( Left(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;,4) &amp;amp; '-W' &amp;amp; Num(Right(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;, Len(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;) - Index(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;,'W')),'00')&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Thanks a lot for all your help and suggestion. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Mar 2022 09:50:48 GMT</pubDate>
    <dc:creator>Neha36</dc:creator>
    <dc:date>2022-03-25T09:50:48Z</dc:date>
    <item>
      <title>Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909336#M74955</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;Maxstring is not working in below scenario:&lt;/P&gt;
&lt;P&gt;Suppose, we have year and week as 2022-W12, 2022-W11, 2022-W10, 2022-W9 and have used Maxstring(YearandWeek) but it is returning output as&amp;nbsp; 2022-W9 instead of&amp;nbsp; 2022-W12. Kindly help me on getting some solutions to fix this issue.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 12:03:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909336#M74955</guid>
      <dc:creator>Neha36</dc:creator>
      <dc:date>2022-03-24T12:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909340#M74956</link>
      <description>&lt;P&gt;2022-W9 is the correct result. W9 is a greater string than W10. You're looking at it as a number rather than a string.&lt;/P&gt;
&lt;P&gt;You should probably use either Weekname() on a date field, or a Dual() field, which would allow you to get the maximum week based on its numeric (date) value.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 12:18:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909340#M74956</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-03-24T12:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909381#M74960</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank You for your suggestion. I tried both WeeKname and Dual but it is not working. The column value of column yearandweek is as 2022-W9, 2022-W10 etc from the calendar table.&lt;/P&gt;
&lt;P&gt;WeeKname(yearandweek) or Dual(yearandweek) --&amp;gt; Is this correct? If yes, then its not working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 13:31:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909381#M74960</guid>
      <dc:creator>Neha36</dc:creator>
      <dc:date>2022-03-24T13:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909468#M74966</link>
      <description>&lt;P&gt;That is not correct. These functions would need to be applied to the date field from which the week is being derived and they cannot be applied to a text string which is not a date. If no such field exists in your data, you would need to derive the numeric value of the week from the string value and create a dual field,which you could probably do by using something along the lines of:&lt;/P&gt;
&lt;P&gt;Dual(YourString,num(KeepChar(YourString,'0123456789')))&lt;/P&gt;
&lt;P&gt;This would result in the numeric values (202209, 202210,202211) being available for sorting or generating a max numeric value (or a FirstSortedValue() )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 15:35:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909468#M74966</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-03-24T15:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909712#M74970</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/141998"&gt;@Neha36&lt;/a&gt;&amp;nbsp;Dual is a great solution ... but maybe you could go back one step and format Week as W09 (with a 0 before the 9)&amp;nbsp; instead of W9 ...&lt;/P&gt;
&lt;P&gt;If you are using something like:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;Year('2022-02-25') &amp;amp; '-W' &amp;amp; Week('2022-02-25')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;gt;&amp;gt; OUTPUT &amp;gt;&amp;gt; 2022-W9&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can format the Week Number using this formula:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;Year('2022-02-25') &amp;amp; '-W' &amp;amp; Num(Week('2022-02-25'),'00')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;gt;&amp;gt; OUTPUT &amp;gt;&amp;gt; 2022-W09&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can replace the '2022-02-25' sample date for the name of your Date field, I'm using it just for testing and explanation purposes. This formatting will work as expected with MaxString.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;---&lt;/P&gt;
&lt;P&gt;If you need for some reason to stick to previous format (using W9), then you could use the similar suggested formatting as second parameter for Dual.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate"&gt;From Qlik Help&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;EM style="color: #339966; font-family: 'courier new', courier;"&gt;&lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate"&gt;Dual()&lt;/SPAN&gt;&amp;nbsp;combines a number and a string into a single record, such that the number representation of the record can be used for sorting and calculation purposes, while the string value can be used for display purposes.&lt;/EM&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="syntax_heading" data-mc-autonum="Syntax: "&gt;&lt;FONT face="courier new,courier" color="#339966"&gt;&lt;EM&gt;&lt;SPAN class="autonumber"&gt;Syntax:&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="statement"&gt;Dual(&lt;/SPAN&gt;text, number&lt;SPAN class="statement"&gt;)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="syntax_heading" data-mc-autonum="Syntax: "&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you need a text and a number version for the same value ...&lt;/P&gt;
&lt;P&gt;In the first parameter you will use your current formula (the one with the desired output that combines text and number W9) and the second parameter will be used the number only version.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;DUAL (&amp;nbsp;Year('2022-02-25') &amp;amp; '-W' &amp;amp; Week('2022-02-25') ,&amp;nbsp; Year('2022-02-25') &amp;amp; Num(Week('2022-02-25'),'00') ) as YearWeekDual&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;so you have inside Qlik something like this :&lt;/P&gt;
&lt;P&gt;Dual ( '2022-W9', 202209) ... text version (1st parameter) and number version (2nd parameter)&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#333333"&gt;Later when the field is used in graphics &lt;U&gt;you can sort it by using NUMERIC value option&lt;/U&gt;&lt;/FONT&gt;, in that case Qlik will use the second value to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;Gerardo&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 08:00:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909712#M74970</guid>
      <dc:creator>Qlik-Gerardo</dc:creator>
      <dc:date>2022-03-25T08:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909732#M74971</link>
      <description>&lt;P&gt;Thank You All.&lt;/P&gt;
&lt;P&gt;I cannot format the year and week number as I am getting these values from calendar dimension table having column yearandweeknumber as 2022-W8, 2022-W9, 2022-W10, 2022-W11, 2022-W12 etc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maxstring(yearandweeknumber) is stored in one variable and this variable is used in the existing code so how can this scenario can be resolved such that variable can be used in the QlikApp.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 08:57:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909732#M74971</guid>
      <dc:creator>Neha36</dc:creator>
      <dc:date>2022-03-25T08:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909747#M74972</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I guess you could modify your expression to reformatting the content before MaxString by spliting every part and rejoining them like this :&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;MaxString( Left(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;,4) &amp;amp; '-W' &amp;amp; Num(Right(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;, Len(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;) - Index(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;,'W')),'00')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Explanation&lt;/U&gt;:&lt;/P&gt;
&lt;P&gt;Left(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;,4) &amp;gt;&amp;gt; Split the year part&lt;/P&gt;
&lt;P&gt;Index(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;,'W')) &amp;gt;&amp;gt; Search where is the W located&lt;/P&gt;
&lt;P&gt;Right(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;, Len(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;) - Index(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;,'W')) &amp;gt;&amp;gt; Take all the numbers that follow W letter&lt;/P&gt;
&lt;P&gt;Num( .... , '00') &amp;gt;&amp;gt; format the previous result and add a 0 before numbers with 1 digit&lt;/P&gt;
&lt;P&gt;The final result before MaxString evaluation will be a number like 2022-W09, 2022-W10, 2022-W12&lt;/P&gt;
&lt;P&gt;MaxString now will give you the desired result ...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--&lt;/P&gt;
&lt;P&gt;If you still need to reformatting the result ... to show it as 2022-W9 you could you Replace() function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replacing W0 text for W text the final formula will be:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Replace(MaxString( Left(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;,4) &amp;amp; '-W' &amp;amp; Num(Right(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;, Len(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;) - Index(&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;,'W')),'00'),'W0','W')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take in consideration that &lt;U&gt;the right formula depends of the final use for this formula&lt;/U&gt;, for sorting purposes the first one will work fine, for Label and Titles you can use the second one but this one will not work fine for sorting.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Gerardo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 09:29:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909747#M74972</guid>
      <dc:creator>Qlik-Gerardo</dc:creator>
      <dc:date>2022-03-25T09:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Maxstring not Working</title>
      <link>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909766#M74975</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The below formula worked fine in my case:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;MaxString( Left(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;,4) &amp;amp; '-W' &amp;amp; Num(Right(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;, Len(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;) - Index(&lt;/SPAN&gt;&lt;SPAN&gt;yearandweeknumber&lt;/SPAN&gt;&lt;SPAN&gt;,'W')),'00')&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Thanks a lot for all your help and suggestion. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 09:50:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Maxstring-not-Working/m-p/1909766#M74975</guid>
      <dc:creator>Neha36</dc:creator>
      <dc:date>2022-03-25T09:50:48Z</dc:date>
    </item>
  </channel>
</rss>

