6 Replies Latest reply: Mar 18, 2013 8:19 AM by Alexandra Bruchmann RSS

    Do while loop

    Alexandra Bruchmann

      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

        • Re: Do while loop
          Jonathan Dienst

          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

            • Re: Do while loop
              Alexandra Bruchmann

              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!!


                • Re: Do while loop
                  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

                    • Re: Do while loop
                      Alexandra Bruchmann

                      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