Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

load table with where two/three fields condition

Guys, i need your help..

how to write script if i want to make table with where condition:

example:

table_a:

LOAD SOURCE1,

     COST_CENTRE,

     DATEGL,

     PERIOD,

     YEARGL,

     MONTHGL,

     PERIOD_REPORT,

     %Admitted,

     AMOUNT,

     MAP_1,

     MAP_2,

     MAP_3,

FROM

D:\table_a.QVD

(qvd)

WHERE [PERIOD_REPORT='2013007','2013008','2013009','2013010','2013011','2013012','2014001','2014002','2014003','2014004']

       and [COST_CENTRE='S812', 'S813', 'S814', 'S815', 'S818', 'S916', 'S919', 'S920', 'S921', 'S922','S923']

       and [MAP_1='Expense'] and [MAP_2='Management Expense']

       and [MAP_3='Depreciation','Fixed Assets Expenses',]

store table_a into table_a.qvd (qvd)

but error when i'm reloading thats script. (T_T)

Please help me ...

1 Solution

Accepted Solutions
fkeuroglian
Partner - Master
Partner - Master

Hi

try this

table_a:

LOAD SOURCE1,

     COST_CENTRE,

     DATEGL,

     PERIOD,

     YEARGL,

     MONTHGL,

     PERIOD_REPORT,

     %Admitted,

     AMOUNT,

     MAP_1,

     MAP_2,

     MAP_3,

FROM

D:\table_a.QVD

(qvd)

WHERE

MATCH(PERIOD_REPORT,'2013007','2013008','2013009','2013010','2013011','2013012','2014001','2014002','2014003','201400)

AND

MATCH(COST_CENTRE,'S812', 'S813', 'S814', 'S815', 'S818', 'S916', 'S919', 'S920', 'S921', 'S922','S923')

AND

MATCH(MAP_1,'Expense')

AND

MATCH(MAP_2,'Management Expense')

AND

MATCH(MAP_3,'Depreciation','Fixed Assets Expenses');

GOOD LUCK

Fernando

     

View solution in original post

5 Replies
Not applicable
Author

please help me (T_T)....

fkeuroglian
Partner - Master
Partner - Master

Hi

try this

table_a:

LOAD SOURCE1,

     COST_CENTRE,

     DATEGL,

     PERIOD,

     YEARGL,

     MONTHGL,

     PERIOD_REPORT,

     %Admitted,

     AMOUNT,

     MAP_1,

     MAP_2,

     MAP_3,

FROM

D:\table_a.QVD

(qvd)

WHERE

MATCH(PERIOD_REPORT,'2013007','2013008','2013009','2013010','2013011','2013012','2014001','2014002','2014003','201400)

AND

MATCH(COST_CENTRE,'S812', 'S813', 'S814', 'S815', 'S818', 'S916', 'S919', 'S920', 'S921', 'S922','S923')

AND

MATCH(MAP_1,'Expense')

AND

MATCH(MAP_2,'Management Expense')

AND

MATCH(MAP_3,'Depreciation','Fixed Assets Expenses');

GOOD LUCK

Fernando

     

maxgro
MVP
MVP

- when you have 1 value you can use an equal

but not in this way as in your script (this is a syntax error)

and [MAP_1='Expense']

in this way

and MAP_1 = 'Expense'

or in this way (brackets are optional, you only need brackets when there are spaces in field name)

and [MAP_1] = 'Expense'


- when you have >1 values you can't use an equal but you can use match or similar function (wildmatch, mixmatch; the syntax is the same, match( str, expr1 [ , expr2,...exprN ] ))

you can use match function also for 1 value, so Fernando answer should be correct





Not applicable
Author

that's great... thank you guys..

i want to ask again, how to write script for change record?

example, if i want to keep jul-des 2013 with mapping a, and jan-apr 2014 with mapping b

Not applicable
Author

for example script sql:

update table_a

set MAP_2='Other Exp'

where MAP_2='Management Expense'

how to translate script sql to script qlikview?