Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
david_ze
New Contributor III

Script assistance

Hi All,
I'll appreciate your assistance on the issue I have as described below:


Contains the first 4 columns - I would like to add a new filed (Potential_Left) with the calculated data  as shown below

WarehouseProduct_PotentialWorkOrderProductionPotential_Left
A5001150350
A5002100

250

A500350200
A50042000

I'll appreciate your advise.

Thanks
David

4 Replies

Re: Script assistance

Hi,

     Load

          Warehouse,

          Product_Potential,

          WorkOrder,

          Production,

          Product_Potential - NumSum(Previous(Potential_Left), Production) AS Potential_Left

     FROM ...

Celambarasan

MVP
MVP

Re: Script assistance

David,

I think it could look like

LOAD

...

if(isnull(peek(Potential_Left)),Product_Potential,peek(Potential_Left))-Production as Potential_Left,

...

from Table;

maybe including a check for Warehouse in the if() statement and using an appropriate order of your records.

Regards,

Stefan

david_ze
New Contributor III

Re: Script assistance

Hi Stefan,
can you attach the scripting you think should matxh here?
I also want to care the case we have an additional warehouse (B, C etc).
Thanks,
David

MVP
MVP

Re: Script assistance

I think it could look like (if your table existing table is labelled TMP):

RESULT:

LOAD Warehouse, Product_Potential, WorkOrder, Production,

if(peek(Warehouse)=Warehouse,peek(Potential_Left), Product_Potential) - Production as Potential_Left

resident TMP order by Warehouse, WorkOrder;

drop table TMP;

Community Browser