Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasmahajan

Script loading

Dear all

I have following script with stockinoutindicator field while loading data from qvd  now I want to give  following

Condition

============================

(Today()-max([Posting Date])) as [Exp Days Items]

where StockInOutIndicator = '1'  

============================

in same qvd file how to achive this can any one help in this matter.

Script 

=============================

ValueEntry_IAL:

LOAD

if([Valued Quantity] >= 0

   AND

     ((Entry_Type = 0 AND Doc_Type = 5)

   OR (Entry_Type = 1 AND Doc_Type = 3)

   OR (Entry_Type = 2)

   OR (Entry_Type = 4 AND Doc_Type = 10)

   OR (Entry_Type = 4 AND Doc_Type = 0)

   OR (Entry_Type = 6)),1,0) AS StockInOutIndicator  

FROM

   [Source QVDs NAV\Value_Entry.qvd]

   (qvd);

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.
13 Replies
Miguel_Angel_Baeyens

Hi,

You can use a preceding load, something like:

ValueEntry_IAL:

LOAD *,

   If(StockInOutIndicator = 1, Today() - Max([Posting Date])) AS [Exp Days Items];

LOAD

   IF([Valued Quantity] >= 0

   AND

     ((Entry_Type = 0 AND Doc_Type = 5)

   OR (Entry_Type = 1 AND Doc_Type = 3)

   OR (Entry_Type = 2)

   OR (Entry_Type = 4 AND Doc_Type = 10)

   OR (Entry_Type = 4 AND Doc_Type = 0)

   OR (Entry_Type = 6)),1,0) AS StockInOutIndicator,

  ... // rest of the fields here

FROM

   [Source QVDs NAV\Value_Entry.qvd]

   (qvd);

Hope that helps.

Miguel

vikasmahajan
Author

Thanks for prompt reply I will get back you.

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.
jagannalla
Partner - Specialist III
Partner - Specialist III

Miguel,

I think Max function will not work while loading with other fields without GroupBy.

Vikasmahajan,

The below code will help you, but make sure Today()-$(vMaxPD) should me in same format

MaxPDTable:

LOAD

max([Posting Date]) as MaxPD

FROM

[Source QVDs NAV\Value_Entry.qvd]

(qvd);

LET vMaxPD = Peek('MaxPD',-1,'MaxPDTable');

ValueEntry_IAL:

LOAD *,(Today()-$(vMaxPD)) as [Exp Days Items]

Where StockInOutIndicator=1;

LOAD *,

if([Valued Quantity] >= 0

   AND

     ((Entry_Type = 0 AND Doc_Type = 5)

   OR (Entry_Type = 1 AND Doc_Type = 3)

   OR (Entry_Type = 2)

   OR (Entry_Type = 4 AND Doc_Type = 10)

   OR (Entry_Type = 4 AND Doc_Type = 0)

   OR (Entry_Type = 6)),1,0) AS StockInOutIndicator 

FROM

[Source QVDs NAV\Value_Entry.qvd]

(qvd)

;

Cheers!!

Jagan

vikasmahajan
Author

you are wright...

Thanks Mr.Jagan I will try let you know the status...

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.
vikasmahajan
Author

I have attached QV1.qvw file  , Please it is loading only 3 records who have

 

StockInOutIndicator = 1 , but  i want all the 4 records  load all data with exp days.

Please reply

Thanks

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.
jagannalla
Partner - Specialist III
Partner - Specialist III

Hello,

Can you attach sample data file(i.e. xyz.qvd).

Thanks,

Jagan

vikasmahajan
Author

I have attached the qvd ,

pls reply.

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.
jagannalla
Partner - Specialist III
Partner - Specialist III

Sorry I didn't seen Inline table. Ok see this image

2.jpg

For max date your StockInOutIndicator gives you zero value. When we are loading the table with condition Where StockInOutIndicator we can see only 3 records.

Cheers!!

Jagan

vikasmahajan
Author

cAN WE SHOW ALL 4 RECORDS AT A TIME ?

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.