Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Rewrite a query with the function "switch" from Microsoft Access to Qlikview

Hi everyone,

please, i need your help because i try to rewrite a query with the function "switch" from Microsoft Access to Qlikview.

E.g. Switch([TESTATA]![Tipo prestazione]="x";Lif(([DETTAGLIO]![codice prestazione]="yyy" or ([DETTAGLIO]![codice prestazione]="zzz";"A";"B")

Otherwise, can you suggest me alternative ways to do this (e.g. load inline table, even if i have multiple sources)?

Thanks in advance,

Mattia

6 Replies
Highlighted

You can just use the If Statement

If(Condition1, Value1,
  If(Condition2, Value2,
    If(Condition3, Value3, Value_Default)))

 

Highlighted
Creator II
Creator II

Ok, thanks Sunny!

I try and i let you know ASAP.

Mattia

 

Highlighted
Digital Support
Digital Support

Mattia, did Sunny's post help you get things working?  I know it has only been a couple of days, so just checking in here, if you need more time, no worries, but be sure to circle back if things work and use the Accept as Solution on Sunny's post if that did work to let others know and to give him credit for the help.  If you are still stuck, leave an update and we'll see if we can find something else.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Highlighted
Creator II
Creator II

Hi Brett and thanks for the message.

Yes, please, i need more time, because i'm a new user of Qlikview.

Don't worry, i give you a feedback ASAP.

Regards,

Mattia

Highlighted
Creator II
Creator II

Hi Brett,

I rewrite the problem with more details because i'm new on Qlikview and the solution is not enough for my needs.

I need to rewrite some queries with the function "switch" from Microsoft Access to Qlikview, but i can have multiple sources and conditions.

Every single query matches and create a new fields, that i want to see in Qlikview.

E.g. This query should create the new field "Tipo_BDG" in Qlikview. In Access the query is the following:

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"; [TESTATA]![ASL/REGIONE] Like "0*" Or [TESTATA]![ASL/REGIONE] Like "1*" Or [TESTATA]![ASL/REGIONE] Like "2*" Or [TESTATA]![ASL/REGIONE] Like "888";"EXTRAREG"

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.

 So, i have three problems:

1) How can I create a new field by rewriting this query?

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?

3) How can I rewrite a value that begin with a certain number (in Access, e.g., I can use  asterisk before the number - 0*).

Otherwise, can you suggest me alternative ways to do this (e.g. load inline table)?

Many thanks,

Mattia

Highlighted
Digital Support
Digital Support

Thanks Mattia, unfortunately you do not want me trying to help you with this one, I am primarily a backend guy, but I do have a place you can do some further searching that might help:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

That is the base URL to the Design Blog area, many of our experts have posted hundreds of how-to type posts, hopefully you might be able to find something to help you move things forward just in case nobody else responds back.  I generally start with one word in the search, see what pops up in the list and look for other/better words to use, hopefully you will be able to find some posts that will help.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.