Jump to content
Server Maintenance This Week. ×

Exiting a loop


This topic is 4809 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am new in data bases so I still know only a few things, hope you can help.

I’m trying to make a script to generate records based on related ones but I can’t end it.

First related record goes ok, then goes to the next and ok too, but on the third goes back to the first and jumps to next, so I get first and second record ok and a nonstop second record.

I’ll appreciate your help.

Set Variable [ $P1; Value:Table 1::P1_ID ]

Go to Related Record [ From table: “Table A”; Using layout: “Table A” (Table A) ]

[ Show only related records ]

Go to Record/Request/Page

[ First ]

Loop

Set Variable [ $As1; Value:Table A::A1_ID ]

Go to Layout [ “Table B” (Tabla B) ]

New Record/Request

Set Field [ Table B::A1_ID; $As1 ]

Set Field [ Table B::P1_ID; $P1 ]

Go to Related Record [ From table: “Table A”; Using layout: “Table A” (Table A) ]

[ Show only related records ]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

Link to comment
Share on other sites

a script to generate records based on related ones

I am not sure what exactly are you trying to accomplish here. I think you want:

Set Variable [ $P1; Value:Table 1::P1_ID ]

If [ not IsEmpty ( Table A::P1_ID ) ]

Go to Related Record [ From table: “Table A”; Using layout: “Table A” (Table A) ][ Show only related records ]

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $As1; Value:Table A::A1_ID ]

Go to Layout [ “Table B” (Table B) ]

New Record/Request

Set Field [ Table B::A1_ID; $As1 ]

Set Field [ Table B::P1_ID; $P1 ]

Go to Layout [ “Table A” (Table A) ]

Go to Record/Request/Page [ Next; Exit after last ]

End Loop

End If

Link to comment
Share on other sites

This topic is 4809 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.