<?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 Functions in Qliksense in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1798090#M64573</link>
    <description>&lt;P&gt;You may not need all those variables because you could nest multiple subfield() like:&lt;/P&gt;&lt;P&gt;subfield(subfield(subfield(F, 'X', 1), 'y', 1), 'z', 1)&lt;/P&gt;&lt;P&gt;Another approach could be to split each string-part directly within loads - within any (inside or outside) loop-logics but I'm not sure that this would be easier in this case.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
    <pubDate>Thu, 08 Apr 2021 16:53:19 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2021-04-08T16:53:19Z</dc:date>
    <item>
      <title>User Defined Functions in Qliksense</title>
      <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747553#M57455</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I would like to know whether it is possible that we have have user defined functions in Qlik sense. As we have in programming languages. The task that i aim to achieve is to apply loop on a certain column names so that i can increase their time based on further conditions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Query is regarding whether can we create a user define function or not. If yes the syntax would help a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attaching Requirement in detail.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6077"&gt;@johnw&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:22:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747553#M57455</guid>
      <dc:creator>Sanket_Sharma</dc:creator>
      <dc:date>2024-11-16T01:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Functions in Qliksense</title>
      <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747566#M57456</link>
      <description>&lt;P&gt;User defined functions are not directly possible but with parametrized variables you are quite close to this kind of functionality:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/dollar-sign-expansion-using-parameters.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/dollar-sign-expansion-using-parameters.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 06:44:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747566#M57456</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-28T06:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Functions in Qliksense</title>
      <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747581#M57457</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Can Loop be applied using dollar sign, also i will be calling this function again and again so that particular column that will be updated, will it retain its value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 07:12:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747581#M57457</guid>
      <dc:creator>Sanket_Sharma</dc:creator>
      <dc:date>2020-09-28T07:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Functions in Qliksense</title>
      <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747586#M57459</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/92211"&gt;@Sanket_Sharma&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Initial thought after going through your requirement - you might not need a UD function, and probably similar could be achieved using qlik functions itself. If you could create a sample app with inline data and may be explain your use case there, we could have a look and give a try to help you.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 07:34:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747586#M57459</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2020-09-28T07:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Functions in Qliksense</title>
      <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747594#M57461</link>
      <description>&lt;P&gt;It's not quite clear for me what you mean with "&lt;SPAN&gt;Can Loop be applied using dollar sign&lt;/SPAN&gt; ..." ? Where do you want to use it?&lt;/P&gt;&lt;P&gt;(Parametrized) variables are mainly a text-replace of other native functions/calculations - separate loops independent to it's dimensionality aren't possible neither in script nor in the UI. A loop needs in general a control- or a load-statement within the script (of course there are a few exceptions).&lt;/P&gt;&lt;P&gt;In regard to your requirement-doc above I'm not sure that you need a customized functions at all. Qlik is designed to create everything needed within a suitable datamodel and not to use "classical" sql/programming logic within it.&lt;/P&gt;&lt;P&gt;In your case I think I would try to use a master-calendar and a master-timetable in which it's quite easily to define within one or maybe several flags which days/hours are working ones and which not. Depending on the data and the complexity you might even need an extra specialized created calendar with hours + minutes and/or maybe multiple ones if there are differences between countries, shifts, factories and so on.&lt;/P&gt;&lt;P&gt;More to it could you find here:&amp;nbsp;&lt;A href="https://community.qlik.com/t5/QlikView-Documents/How-to-use-Master-Calendar-and-Date-Values/ta-p/1495741" target="_self"&gt;How-to-use-Master-Calendar-and-Date-Values&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 07:46:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1747594#M57461</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-28T07:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Functions in Qliksense</title>
      <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1798066#M64566</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/92211"&gt;@Sanket_Sharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have run into a similar situation ...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Map_Partner:
Mapping LOAD * INLINE [
  lookup, partner
  'y', 'YYYYY',
  'y/b', 'YYYBBB'
];

// Subroutine

Sub CleanPartnerName (brand)
    // Extract the partner from between the two pipelines of the idorder field 
    Let partnerName = trim(SubField(lower(brand), '|', 2));
    
    // Remove anything after a "\"
    partnerName = SubField(partnerName,'\',1);
    // Remove anything after "&amp;amp;amp"
    partnerName = SubField(partnerName,'&amp;amp;amp',1);
    // Remove anything after a "?"
    partnerName = SubField(partnerName,'?',1);
    // Remove trailing "/"
	if((Len(partnerName) - 1) = Len(SubField(partnerName, '/', 1))) then
    	partnerName = SubField(partnerName, '/', 1);
    end if
    
    brand = ApplyMap('Map_Partner', partnerName, 'Untracked Leads')
        
End Sub

Call CleanPartnerName ('x|y|z');


// Dollar expansion

SET extractPartnerName = "SubField(lower($1), '|', 2)";
SET removeBackSlash = "SubField($(extractPartnerName($1)), '\', 1)";
SET removeAmpersand = "SubField($(removeBackSlash($1)),'&amp;amp;amp',1)";
SET removeQuestionMark = "SubField($(removeAmpersand($1)),'?',1)";
SET removeTrailingFowardSlash = "If((Len($(removeQuestionMark($1))) - 1) = Len(SubField($(removeQuestionMark($1)), '/', 1)), SubField($(removeQuestionMark($1)), '/', 1), $(removeQuestionMark($1)))";
SET cleanPartnerName = "Trim($(removeTrailingFowardSlash($1)))";

FinalData:
LOAD 
ID, 
ApplyMap('Map_Partner', $(cleanPartnerName(brand)), 'Untracked Leads') as partner_name
Inline [
ID, brand
123,x|y|x
145,x|y/b|x
156,x|y/|x
179,x|z\|x
];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to achieve the intended result using the dollar expansion but as you can see it gets very untidy. Is there any better approach I am missing here? The logic in the sub routine is much more clear and self-explained.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 16:04:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1798066#M64566</guid>
      <dc:creator>gabriel-spiteri</dc:creator>
      <dc:date>2021-04-08T16:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Functions in Qliksense</title>
      <link>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1798090#M64573</link>
      <description>&lt;P&gt;You may not need all those variables because you could nest multiple subfield() like:&lt;/P&gt;&lt;P&gt;subfield(subfield(subfield(F, 'X', 1), 'y', 1), 'z', 1)&lt;/P&gt;&lt;P&gt;Another approach could be to split each string-part directly within loads - within any (inside or outside) loop-logics but I'm not sure that this would be easier in this case.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 16:53:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/User-Defined-Functions-in-Qliksense/m-p/1798090#M64573</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-04-08T16:53:19Z</dc:date>
    </item>
  </channel>
</rss>

