Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Do while loop

Hello,

I need some help. I need a do while loop like this:

a, b, c and d are all fields out of tables and all are Dates. I'm a beginner with QlikView, so I hope it will be not so difficult.

I tried it, but it do not work.

Thanks for all help!!

do while (a=b)
load
rangesum ((b-a),c) as LD,
NetWorkDays (d, rangesum((b-a),c)) as AT
Resident Temp2;
Let a=At; c=LD;
loop

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Result:

load *, delivery_date - goods_issue_date as delivery_time;

load goods_issue_date, no_of_working_days,

lastworkdate(goods_issue_date, no_of_working_days) as delivery_date

from ...etc


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Your code does not make any sense to me, you appear to be using a, b, c as variables in some places and as fields in others.

Can I suggest that you explain what you are trying to achieve and I expect that someone will then be able to help you.

Regards

Jonathan

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

Ok, I try.

Also, I have 4 dates in a table, this are the delivery time in days, the delivery date, the goods issue date and the workingday between the delivery date and the goods issue date.

I have the Problem, that I have to calculate the delivery date by my self out of the delivery time and the goods issue date. So it can be, that the delivery date will be on a Saturday or Sunday, but this is not true.

So I help me with the workingdays between the delivery date and the goods issue date.

The delivery time must be the same as the working days between the goods issue date and the delivery date.

Now you can replace a,b,c and d with this four dates.

a should be the working days between the goods issue date and the delivery date, b the delivery time, c the delivery date and d the goods issue date.

In the end I will have a right delivery date, which is not on saturday, or sunday.

Maybe its a lot easier than I  tried it.

I hope you understand me and can help me now. If anything is unclear, please ask for it, I try to explain.

Thank you very much für your help!!


Gysbert_Wassenaar

Result:

load *, delivery_date - goods_issue_date as delivery_time;

load goods_issue_date, no_of_working_days,

lastworkdate(goods_issue_date, no_of_working_days) as delivery_date

from ...etc


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hey,

thanks very much. It works, but it don't include my holidays.

tmpFeiertage:

LOAD Date([Feiertagsdatum]) as Date

FROM .\qvd\Betriebskalenderfeiertage.qvd (qvd);

tmpVerkettung:

LOAD concat(chr(39) & tmpFeiertage.Date & chr(39),',') AS Feiertagsdatum

RESIDENT tmpFeiertage;

Let vFeiertage = fieldvalue('Feiertagsdatum',1);

DROP TABLE tmpFeiertage;

DROP TABLE tmpVerkettung;

Temp2:

Load *,

    LastWorkDate (date([Temp.Warenausg_-Datum]), Temp.TransportTage, $(vFeiertage)) as Lieferdatum

resident Temp;

Is this right? It don't note the holidays.

Regards

Alex

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I think you need to change tmpVerkettung as follows:

tmpVerkettung:

LOAD chr(39) & concat(chr(39) & tmpFeiertage.Date & chr(39),',') & chr(39) AS Feiertagsdatum

RESIDENT tmpFeiertage;

And I would use peek rather than FieldValue:

Let vFeiertage = Peek('Feiertagsdatum');

The rest of the script looks correct to me.

Regards

Jonathan

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

Hey.

thanks a lot. I think now it works correctly.

Regards

Alex