<?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: Rewrite a query with the function &amp;quot;switch&amp;quot; from Microsoft Access to Qlikview in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1637201#M596110</link>
    <description>&lt;P&gt;Hello Mattia,&lt;/P&gt;&lt;P&gt;I will go 3,2,1&lt;/P&gt;&lt;P&gt;3) I think you are asking for the WildMatch(Attribute, Value) function.&lt;/P&gt;&lt;P&gt;To use your example, it works like (WildMatch([tipo prestazione], '*J*')&lt;/P&gt;&lt;P&gt;Check it out here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) You need to 'mix' the sources together. You can either 'Join' or Map the two source ( and ) .&lt;/P&gt;&lt;P&gt;I'd recommend you use the mapping function you can check here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) First is first - Indentation (I suspect your query has a missing ')' for the switch btw):&lt;/P&gt;&lt;P&gt;If this is all one big switch statement, with output of 1 attribute, then:&lt;/P&gt;&lt;P&gt;Switch(&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "J";"J";&lt;BR /&gt;[TESTATA]![tipo PROGETTO] Like "K";"K";&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "S";&lt;/P&gt;&lt;P&gt;IIf(([DETTAGLIO]![codice prestazione] Like "presta1") Or ([DETTAGLIO]![codice prestazione] Like "presta2");"SCREENING";"BDG");&lt;/P&gt;&lt;P&gt;[TESTATA]![Regime erogazione]="7";"STRANIERI";&lt;BR /&gt;[TESTATA]![Regime erogazione]="8";"BDG";&lt;/P&gt;&lt;P&gt;[TESTATA]![ASL/REGIONE] Like "0*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "1*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "2*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "888";"EXTRAREG"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;Simplest of all methods would be something like:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J',&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K',&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S',&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING',&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI',&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG',&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG'&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;) As ThisOneFieldAttribute&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I suspect you are posting a query for multiple attributes so it looks like this:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J') as Attr1,&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K') as Attr2,&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S') as Attr3,&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING') as Attr4,&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI') as Attr5,&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG') as Attr6,&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG') as Attr7&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;S.T.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Oct 2019 13:31:27 GMT</pubDate>
    <dc:creator>Stoyan_Terziev</dc:creator>
    <dc:date>2019-10-18T13:31:27Z</dc:date>
    <item>
      <title>Rewrite a query with the function "switch" from Microsoft Access to Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1636916#M596109</link>
      <description>&lt;DIV class="topic-subject-wrapper"&gt;&lt;DIV class="lia-message-subject lia-component-message-view-widget-subject"&gt;&lt;DIV class="MessageSubject"&gt;&lt;SPAN&gt;Hi Everyone,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="MessageSubject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;I need to rewrite&amp;nbsp;some queries with the function "switch" from Microsoft Access to Qlikview, but i can have multiple sources and conditions.&lt;/P&gt;&lt;P&gt;Every single query matches and create a new fields, that i want to see in Qlikview.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;E.g. This query should create the new field "Tipo_BDG" in Qlikview. In Access the query is the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Switch([TESTATA]![tipo prestazione] Like "J";"J";[TESTATA]![tipo PROGETTO] Like "K";"K";[TESTATA]![tipo prestazione] Like "S";IIf(([DETTAGLIO]![codice prestazione] Like "presta1") Or ([DETTAGLIO]![codice prestazione] Like "presta2");"SCREENING";"BDG");[TESTATA]![Regime erogazione]="7";"STRANIERI";[TESTATA]![Regime erogazione]="8";"BDG";&amp;nbsp;[TESTATA]![ASL/REGIONE] Like "0*" Or [TESTATA]![ASL/REGIONE] Like "1*" Or [TESTATA]![ASL/REGIONE] Like "2*" Or [TESTATA]![ASL/REGIONE] Like "888";"EXTRAREG"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;where "TESTATA" is the name of the 1st file (source), "DETTAGLIO" is the name of the 2nd file (another source) and "tipo prestazione", "tipo progetto", "codice prestazione", "ASL/REGIONE" and "regime erogazione" are the name of the fields in the different file/sources.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;So, i have three problems:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1) How can I create a new field by rewriting this query?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2) How can I rewrite the query and the if statement with multiple sources, conditions and fields involved? Can coexist in the same query in Qlikview?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3) How can I rewrite a value that begin with a certain number (in Access, e.g., I can use&amp;nbsp; asterisk before the number - 0*).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Otherwise, can you suggest me alternative ways to do this (e.g. load inline table)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please, help me!!!&lt;/P&gt;&lt;P&gt;Thanx,&lt;/P&gt;&lt;P&gt;Mattia&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:52:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1636916#M596109</guid>
      <dc:creator>Mattia</dc:creator>
      <dc:date>2024-11-16T19:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite a query with the function "switch" from Microsoft Access to Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1637201#M596110</link>
      <description>&lt;P&gt;Hello Mattia,&lt;/P&gt;&lt;P&gt;I will go 3,2,1&lt;/P&gt;&lt;P&gt;3) I think you are asking for the WildMatch(Attribute, Value) function.&lt;/P&gt;&lt;P&gt;To use your example, it works like (WildMatch([tipo prestazione], '*J*')&lt;/P&gt;&lt;P&gt;Check it out here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) You need to 'mix' the sources together. You can either 'Join' or Map the two source ( and ) .&lt;/P&gt;&lt;P&gt;I'd recommend you use the mapping function you can check here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) First is first - Indentation (I suspect your query has a missing ')' for the switch btw):&lt;/P&gt;&lt;P&gt;If this is all one big switch statement, with output of 1 attribute, then:&lt;/P&gt;&lt;P&gt;Switch(&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "J";"J";&lt;BR /&gt;[TESTATA]![tipo PROGETTO] Like "K";"K";&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "S";&lt;/P&gt;&lt;P&gt;IIf(([DETTAGLIO]![codice prestazione] Like "presta1") Or ([DETTAGLIO]![codice prestazione] Like "presta2");"SCREENING";"BDG");&lt;/P&gt;&lt;P&gt;[TESTATA]![Regime erogazione]="7";"STRANIERI";&lt;BR /&gt;[TESTATA]![Regime erogazione]="8";"BDG";&lt;/P&gt;&lt;P&gt;[TESTATA]![ASL/REGIONE] Like "0*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "1*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "2*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "888";"EXTRAREG"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;Simplest of all methods would be something like:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J',&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K',&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S',&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING',&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI',&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG',&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG'&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;) As ThisOneFieldAttribute&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I suspect you are posting a query for multiple attributes so it looks like this:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J') as Attr1,&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K') as Attr2,&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S') as Attr3,&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING') as Attr4,&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI') as Attr5,&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG') as Attr6,&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG') as Attr7&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;S.T.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 13:31:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1637201#M596110</guid>
      <dc:creator>Stoyan_Terziev</dc:creator>
      <dc:date>2019-10-18T13:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite a query with the function "switch" from Microsoft Access to Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1637297#M596111</link>
      <description>&lt;P&gt;Hello Mattia,&lt;/P&gt;&lt;P&gt;I will go 3,2,1&lt;/P&gt;&lt;P&gt;3) I think you are asking for the WildMatch(Attribute, Value) function.&lt;/P&gt;&lt;P&gt;To use your example, it works like (WildMatch([tipo prestazione], '*J*')&lt;/P&gt;&lt;P&gt;Check it out here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) You need to 'mix' the sources together. You can either 'Join' or Map the two source ( and ) .&lt;/P&gt;&lt;P&gt;I'd recommend you use the mapping function you can check here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) First is first - Indentation (I suspect your query has a missing ')' for the switch btw):&lt;/P&gt;&lt;P&gt;If this is all one big switch statement, with output of 1 attribute, then:&lt;/P&gt;&lt;P&gt;Switch(&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "J";"J";&lt;BR /&gt;[TESTATA]![tipo PROGETTO] Like "K";"K";&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "S";&lt;/P&gt;&lt;P&gt;IIf(([DETTAGLIO]![codice prestazione] Like "presta1") Or ([DETTAGLIO]![codice prestazione] Like "presta2");"SCREENING";"BDG");&lt;/P&gt;&lt;P&gt;[TESTATA]![Regime erogazione]="7";"STRANIERI";&lt;BR /&gt;[TESTATA]![Regime erogazione]="8";"BDG";&lt;/P&gt;&lt;P&gt;[TESTATA]![ASL/REGIONE] Like "0*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "1*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "2*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "888";"EXTRAREG"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;Simplest of all methods would be something like:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J',&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K',&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S',&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING',&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI',&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG',&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG'&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;) As ThisOneFieldAttribute&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I suspect you are posting a query for multiple attributes so it looks like this:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J') as Attr1,&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K') as Attr2,&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S') as Attr3,&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING') as Attr4,&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI') as Attr5,&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG') as Attr6,&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG') as Attr7&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;S.T.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 15:56:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1637297#M596111</guid>
      <dc:creator>Stoyan_Terziev</dc:creator>
      <dc:date>2019-10-18T15:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite a query with the function "switch" from Microsoft Access to Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1637301#M596112</link>
      <description>&lt;P&gt;Hello Mattia,&lt;/P&gt;&lt;P&gt;I will go 3,2,1&lt;/P&gt;&lt;P&gt;3) I think you are asking for the WildMatch(Attribute, Value) function.&lt;/P&gt;&lt;P&gt;To use your example, it works like (WildMatch([tipo prestazione], '*J*')&lt;/P&gt;&lt;P&gt;Check it out here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/wildmatch.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) You need to 'mix' the sources together. You can either 'Join' or Map the two source ( and ) .&lt;/P&gt;&lt;P&gt;I'd recommend you use the mapping function you can check here:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptPrefixes/Mapping.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) First is first - Indentation (I suspect your query has a missing ')' for the switch btw):&lt;/P&gt;&lt;P&gt;If this is all one big switch statement, with output of 1 attribute, then:&lt;/P&gt;&lt;P&gt;Switch(&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "J";"J";&lt;BR /&gt;[TESTATA]![tipo PROGETTO] Like "K";"K";&lt;BR /&gt;[TESTATA]![tipo prestazione] Like "S";&lt;/P&gt;&lt;P&gt;IIf(([DETTAGLIO]![codice prestazione] Like "presta1") Or ([DETTAGLIO]![codice prestazione] Like "presta2");"SCREENING";"BDG");&lt;/P&gt;&lt;P&gt;[TESTATA]![Regime erogazione]="7";"STRANIERI";&lt;BR /&gt;[TESTATA]![Regime erogazione]="8";"BDG";&lt;/P&gt;&lt;P&gt;[TESTATA]![ASL/REGIONE] Like "0*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "1*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "2*"&lt;BR /&gt;Or [TESTATA]![ASL/REGIONE] Like "888";"EXTRAREG"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;Simplest of all methods would be something like:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J',&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K',&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S',&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING',&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI',&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG',&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG'&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;) As ThisOneFieldAttribute&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I suspect you are posting a query for multiple attributes so it looks like this:&lt;/P&gt;&lt;P&gt;TESTATA:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;If(WildMatch([tipo prestazione], '*J*'), 'J') as Attr1,&lt;BR /&gt;If(WildMatch([tipo PROGETTO], '*K*'), 'K') as Attr2,&lt;BR /&gt;If(WildMatch([tipo prestazione], '*S*'), 'S') as Attr3,&lt;BR /&gt;If(WildMatch(ApplyMap('MapDETTAGLIO', KeyFieldBetweenTESTATAandDETTAGLIO, 'n/a'), '*presta1*', '*presta2*'), 'SCREENING') as Attr4,&lt;BR /&gt;IF([Regime erogazione]='7', 'STRANIERI') as Attr5,&lt;BR /&gt;IF([Regime erogazione]='8', 'BDG') as Attr6,&lt;BR /&gt;IF(WildMatch([ASL/REGIONE], '0*', '1*', '2*', '2*' '888'), 'EXTRAREG') as Attr7&lt;BR /&gt;FROM TESTATA&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;S.T.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 16:00:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1637301#M596112</guid>
      <dc:creator>Stoyan_Terziev</dc:creator>
      <dc:date>2019-10-18T16:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite a query with the function "switch" from Microsoft Access to Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1639184#M596113</link>
      <description>&lt;P&gt;Mattia, did Stoyan's post get you what you needed to move forward?&amp;nbsp; If so, please be sure to come back to your thread and use the Accept as Solution button on his post to give him credit for the help and let others know things worked.&amp;nbsp; If you are still in need of further help, please provide a further update on where things stand.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 19:08:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rewrite-a-query-with-the-function-quot-switch-quot-from/m-p/1639184#M596113</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-10-23T19:08:44Z</dc:date>
    </item>
  </channel>
</rss>

