Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change column values for few rows in qvd?

Hi All,

I need to update the column QTY_STOCK by setting it to 0 based on certain conditions while reading it in my dashboard.

The qvd is being read when I'm using below script but the QTY_STOCK value is not being updated as per the below condition for date = '18/07/2016' and shop_code and item_number even though these records do exist in my qvd:

   

DECLARATION_DATESHOP_CODEITEM_NUMBERQTY_STOCK
18/07/20161001BR0034SAM01152012
18/07/20161001GL0014SAM01152013
18/07/20161001BR0034APP01680020
18/07/20161001GL0014APP01680021
18/07/20161001BR0034APP01680030
18/07/20161001GL0014APP01680032
18/07/20161001GL0014LGE01870011
18/07/20161001BR0034SAM01152032
18/07/20161001GL0014SAM01152033
18/07/20161001BR0034LGE01850015
18/07/20161001GL0014LGE01850013
18/07/20161001BR0034HWI01190012
18/07/20161001GL0014HWI01190012
18/07/20161001BR0034SAM01152041
18/07/20161001BR0034SAM01168031
18/07/20161001GL0014SAM01168030
18/07/20161001BR0034HWI01140040
18/07/20161001GL0014HWI01140045
18/07/20161001BR0034APP01680010
18/07/20161001GL0014APP01680012
18/07/20161001BR0034SAM01168013
18/07/20161001GL0014SAM01168010
18/07/20161001BR0034APP01690013
18/07/20161001GL0014APP01690012
18/07/20161001BR0034SAM01168024
18/07/20161001GL0014SAM01168020
18/07/20161001BR0034APP01680040
18/07/20161001GL0014APP01680043

Could you please help?

Thanks in advance

LOAD

if((DECLARATION_DATE = '18/07/2016' and

  SHOP_CODE = '1001BR0034' and

  (

  ITEM_NUMBER='APP0168001' or

  ITEM_NUMBER='APP0168002' or

  ITEM_NUMBER='APP0168003' or

  ITEM_NUMBER='APP0168004'

  )

    )

    or

    (DECLARATION_DATE = '18/07/2016' and

  SHOP_CODE = '1001GL0014' and

  (

  ITEM_NUMBER='SAM0116801' or

  ITEM_NUMBER='SAM0116802' or

  ITEM_NUMBER='SAM0116803'

  )

    )

    ,

    0,

    QTY_STOCK) as QTY_STOCK

FROM DATA.QVD

(qvd);

1 Solution

Accepted Solutions
Not applicable
Author

woah that's cool!!! THanks Avinash R, your code is working great!

View solution in original post

6 Replies
avinashelite

You have not added all the combinations

Try like this

LOAD

if((DECLARATION_DATE = '18/07/2016' and

  (SHOP_CODE = '1001BR0034' or SHOP_CODE ='1001GL0014')and

  (

  ITEM_NUMBER='APP0168001' or

  ITEM_NUMBER='APP0168002' or

  ITEM_NUMBER='APP0168003' or

  ITEM_NUMBER='APP0168004'

  )

    )

    or

    (DECLARATION_DATE = '18/07/2016' and

  (SHOP_CODE = '1001GL0014' or SHOP_CODE ='1001BR0034') and

  (

  ITEM_NUMBER='SAM0116801' or

  ITEM_NUMBER='SAM0116802' or

  ITEM_NUMBER='SAM0116803'

  )

    )

    ,

    0,

    QTY_STOCK) as QTY_STOCK

FROM DATA.QVD

(qvd);

jonathandienst
Partner - Champion III
Partner - Champion III

You have most of it already:

Data:

LOAD

  DECLARATION_DATE,

  SHOP_CODE,

  ITEM_NUMBER,

  If(

  (DECLARATION_DATE = '18/07/2016' and

   SHOP_CODE = '1001BR0034' and

   (

   ITEM_NUMBER='APP0168001' or

   ITEM_NUMBER='APP0168002' or

   ITEM_NUMBER='APP0168003' or

   ITEM_NUMBER='APP0168004'

   )

  )

  or

  (DECLARATION_DATE = '18/07/2016' and

  SHOP_CODE = '1001GL0014' and

  (

   ITEM_NUMBER='SAM0116801' or

   ITEM_NUMBER='SAM0116802' or

   ITEM_NUMBER='SAM0116803'

  )

  ),

  0,

  QTY_STOCK

  ) as QTY_STOCK

FROM DATA.QVD

(qvd);

STORE Data into DATA.qvd (qvd);

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

woah that's cool!!! THanks Avinash R, your code is working great!

Not applicable
Author

Thanks also Jonathan for your help and proposition

avinashelite

Could you please mark the correct and helpful answers

Not applicable
Author

Done

Could you please also help in a topic related with this one?

How to count num shops having stock 0 grouped at shop level?