![]() |
€uromeinke, FEJ. and Ghoulish Delight RULE!!! NA abides. |
|
![]() |
#1 |
Chowder Head
Join Date: Jan 2005
Location: Yes
Posts: 18,500
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
A Question for the Programmers
While I have a lot more free time on my hands, I am helping a friend of mine who owns a small business. I am making some updates in his FileMaker Pro (FMP) database. I am not trained as a programmer and have very little experience, mostly just stumbling my way through.
I am reverse engineering some code that someone else used to repurpose for my use. However, I am running into challenges and there is one small bit that I don't understand (though I may be overthinking it). I have put the (non-standard) FMP language in more understandable (hopefully) terms and I put some parts in (parenthesis). The part that has me stumped is the "EXIT LOOP IF [1 = 1]": Code:
INSERT TEXT "1" (into field "ABC") LOOP IF ABC = 1 DUPLICATE RECORD INSERT TEXT "" (into field "ABC") EXIT LOOP IF [1 = 1] ELSE GO TO NEXT PORTAL ROW END IF END LOOP (Command to copy certain text) LOOP IF ABC = 1 INSERT TEXT "" (into field "ABC") EXIT LOOP IF [1 = 1] ELSE GO TO NEXT PORTAL ROW END IF END LOOP
__________________
The thing about quotes on the internet is that you cannot verify their validity.
- Abraham Lincoln |
![]() |
Submit to Quotes
![]() |
![]() |
#2 |
.
Join Date: Feb 2005
Posts: 13,354
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Not an expert as it has been a long time so I may be forgetting some idiosyncrasy but it looks that way.
|
![]() |
Submit to Quotes
![]() |
![]() |
#3 |
I Floop the Pig
|
Hmm. Is there no "break" statement in FMP? That would be the only thing I can think of, that someone kludged a break statement in. If finding the first instance where ABC = 1 is good enough, with no need to continue through the full loop, that would make sense.
__________________
'He who receives an idea from me, receives instruction himself without lessening mine; as he who lights his taper at mine, receives light without darkening me.' -TJ |
![]() |
Submit to Quotes
![]() |
![]() |
#4 |
Chowder Head
Join Date: Jan 2005
Location: Yes
Posts: 18,500
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
No break -- it's a very old version (v. 6 and they just released v. 12).
So, any idea why a loop might have been built in?
__________________
The thing about quotes on the internet is that you cannot verify their validity.
- Abraham Lincoln |
![]() |
Submit to Quotes
![]() |
![]() |
#5 |
I Floop the Pig
|
If I follow correctly, the "Insert" line adds the value "1" to any record that matches "ABC". The loop then goes through all the records looking for a "1". If it finds a "1", then there must have been a record matching "ABC", so "ABC" is a duplicate.
Or something like that.
__________________
'He who receives an idea from me, receives instruction himself without lessening mine; as he who lights his taper at mine, receives light without darkening me.' -TJ |
![]() |
Submit to Quotes
![]() |
![]() |
#6 |
Senior Member
Join Date: Mar 2006
Posts: 2,483
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Looks like that's how they exited the loop, as GD said, it's used as the break statement to get out of the loop.
|
![]() |
Submit to Quotes
![]() |
![]() |
#7 |
I Floop the Pig
|
Actually, on another read it looks like what it's doing is trying to duplicate an existing record, rather than find a duplicate (stupid English). So it goes through the loop until it finds the record it wants to duplicate, then breaks out.
__________________
'He who receives an idea from me, receives instruction himself without lessening mine; as he who lights his taper at mine, receives light without darkening me.' -TJ |
![]() |
Submit to Quotes
![]() |
![]() |
#8 |
Chowder Head
Join Date: Jan 2005
Location: Yes
Posts: 18,500
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
On rereading, I see my error in misreading. The loop exit only occurs when ABC equals 1: I was erroneously reading the string that the routine would never loop because of the "1=1" exit.
Hopefully I can figure out the bigger problem on Wednesday. Yes, the routine is to duplicate a record. Unfortunately, when I try to replicate (repurpose) the code, it wasn't working. Hopefully when I look at this with a fresh mind, the problem will become apparent.
__________________
The thing about quotes on the internet is that you cannot verify their validity.
- Abraham Lincoln |
![]() |
Submit to Quotes
![]() |