Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL conditions in Qlikview

Hi

I need to convert existing BO reports into Qlikview

There are some simple conditions mentioned in where clause of SQL like ( SELECT col1,col2 from table where table.col1='A' )ould

Should I implement these conditions at script level or it should be at UI level

16 Replies
anushree1
Specialist II
Specialist II

It is always a good practice to move most of the filter and calculation conditions to Script to make the performance better

Frank_Hartmann
Master II
Master II

try like that

Load

col1,

col2

FROM

[pathofsource]

where col1='A';

vinod_nallapaneni

You better implement these conditions at script level.

Perhaps even better would be to SET a variable that would be used by no of SQL queries. So that if you want to change it in the future, you will have to change it once.

Anil_Babu_Samineni

Logic one,

1) Did you connect to BO Database?

2) If your answer is "YES" then check whether the field is there or not?

3) Then You can use Set operations, Can you please provide more information on this for third point?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
arulsettu
Master III
Master III

try this

in script:

Load

col1,

col2

from......

where col1='A'

in front end:

sum({<col1={'A'}>}value)

this based on your requirement

vikasmahajan

You can use set analysis for the same

Select sum(Sales) where year=2015

Sum( {$ <Year = {2015} >} Sales )

or

Sum ({$<Year ={$(=YearName(max(Date)))},>} Sales)

Hope this helps you

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

based on your requirement if that filtration is only for few reports you can give in UI part in set expression.

like this    =sum({<Col1={'A'}>}Sales)

If you restrict that col1='A' for all reports then it's better to give in script part like

Load col1,

        col2,

        col3,

        sales

where col1='A';

select * from

tablename;

Not applicable
Author

Hi,

Please see below sample query

SELECT  

Table1.Col1,Table2.Col2

FROM  

Table1,Table2,Table3  

WHERE  

Table1.Col1=Table2.Col2

AND Table2.Col3=Table3.Col4

  AND    

  (  

   Table1.col1 In  ('111')  

   AND  

   Table1.col2  <>  '31-12-1899 00:00:00' 

   AND  

   Table1.col4 BETWEEN 'DATE RANGE'  

   AND  

   Table2.col5  In  ( 'Text' )  

   AND  

   (  

    Table1.col3  Like  'A%'  

    OR  

      Table2.col4 Like  'A%'  

    OR  

    Table3.col6  Like  'A%'  

   )  

  )  

antoniotiman
Master III
Master III

Hi,

You can use in QV script the same sintax

Connect to ......

SQL Select  col1,col2 from Table where col1 ='A' ;

If You don't need records having col1 <> 'A', then I suggest Level Script.

In script Load is used with File (xls,csv,txt,QVD,etc.) or with Resident Table (already loaded)

Regards,

Antonio