Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Break for loop?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Dec 6, 2016 5:54 AM Last Post By: Eric ten Westen...
Eric ten Westen...

Posts: 78
Registered: 12/8/99
Break for loop?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 2, 2016 2:25 AM
Hi

Is there any way to break a for loop?

 FOR SELECT ID, REWARDPERCENTAGE, REWARDUNIT, POINTSPERUNIT, PRIO, STARTDATE
      FROM COMPANYREWARD
      WHERE ID__DAYOFTHEWEEK = :ID__DAYOFTHEWEEK
        AND STARTDATE <= :TRANSACTIONDATE
        AND ( ENDDATE IS NULL  OR ENDDATE >= :TRANSACTIONDATE)
        AND STARTTIME <= :TRANSACTIONTIME
        AND (ENDTIME IS NULL OR ENDTIME >= :TRANSACTIONTIME)
      ORDER BY PRIO, STARTDATE, STARTTIME
      INTO :ID, :REWARDPERCENTAGE, :REWARDUNIT, :POINTSPERUNIT, :lPrio, :lStartdate DO
  BEGIN
    IF (:lPrio >= :lHighPrio) THEN
    BEGIN
     lHighPrio = :lPrio;
     IF ((TRANSACTIONDATE - :lStartdate) <= :llowDiffDate) THEN
     BEGIN
       llowDiffDate = TRANSACTIONDATE - :lStartdate;
      END
    END
    ELSE
      Break;
  END


Eric
quinn wildman

Posts: 856
Registered: 12/2/99
Re: Break for loop?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 5, 2016 2:18 PM   in response to: Eric ten Westen... in response to: Eric ten Westen...
I've not tried it, but raising an exception might work. See: http://docwiki.embarcadero.com/InterBase/XE7/en/EXCEPTION

Eric ten Westenend wrote:
Hi

Is there any way to break a for loop?

 FOR SELECT ID, REWARDPERCENTAGE, REWARDUNIT, POINTSPERUNIT, PRIO, STARTDATE
      FROM COMPANYREWARD
      WHERE ID__DAYOFTHEWEEK = :ID__DAYOFTHEWEEK
        AND STARTDATE <= :TRANSACTIONDATE
        AND ( ENDDATE IS NULL  OR ENDDATE >= :TRANSACTIONDATE)
        AND STARTTIME <= :TRANSACTIONTIME
        AND (ENDTIME IS NULL OR ENDTIME >= :TRANSACTIONTIME)
      ORDER BY PRIO, STARTDATE, STARTTIME
      INTO :ID, :REWARDPERCENTAGE, :REWARDUNIT, :POINTSPERUNIT, :lPrio, :lStartdate DO
  BEGIN
    IF (:lPrio >= :lHighPrio) THEN
    BEGIN
     lHighPrio = :lPrio;
     IF ((TRANSACTIONDATE - :lStartdate) <= :llowDiffDate) THEN
     BEGIN
       llowDiffDate = TRANSACTIONDATE - :lStartdate;
      END
    END
    ELSE
      Break;
  END


Eric
Eric ten Westen...

Posts: 10
Registered: 6/1/15
Re: Break for loop?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 6, 2016 5:54 AM   in response to: quinn wildman in response to: quinn wildman
Hi

yes i think that will work but i need the result to
Eric

quinn wildman wrote:
I've not tried it, but raising an exception might work. See: http://docwiki.embarcadero.com/InterBase/XE7/en/EXCEPTION

Eric ten Westenend wrote:
Hi

Is there any way to break a for loop?

 FOR SELECT ID, REWARDPERCENTAGE, REWARDUNIT, POINTSPERUNIT, PRIO, STARTDATE
      FROM COMPANYREWARD
      WHERE ID__DAYOFTHEWEEK = :ID__DAYOFTHEWEEK
        AND STARTDATE <= :TRANSACTIONDATE
        AND ( ENDDATE IS NULL  OR ENDDATE >= :TRANSACTIONDATE)
        AND STARTTIME <= :TRANSACTIONTIME
        AND (ENDTIME IS NULL OR ENDTIME >= :TRANSACTIONTIME)
      ORDER BY PRIO, STARTDATE, STARTTIME
      INTO :ID, :REWARDPERCENTAGE, :REWARDUNIT, :POINTSPERUNIT, :lPrio, :lStartdate DO
  BEGIN
    IF (:lPrio >= :lHighPrio) THEN
    BEGIN
     lHighPrio = :lPrio;
     IF ((TRANSACTIONDATE - :lStartdate) <= :llowDiffDate) THEN
     BEGIN
       llowDiffDate = TRANSACTIONDATE - :lStartdate;
      END
    END
    ELSE
      Break;
  END


Eric
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02