Script problem

  • Follow


I am having a problem with the following script. Using FM 6 on Mac OS 9.
The script is supposed to check if the user has properly entered the correct
publication and an issue number that is greater than zero. The publication
must be entered as either Condo Source or New Homes, any other variation is
unacceptable.

Example: 
Condo Source
12
Result: No problem

Example
New Homes
12
Result: This result is not recognized as valid and loop cycles, asking you
to re-enter the correct data. If you hit enter again without changing
anything or simply enter inthe exact same information, it passes the exit
loop test and life goes on. In short it passes the exit loop test only after
the second cycle.

I think the problem is the second "or" statment in the exit loop. This
statement/expression is not being evaluated until the loop cycles the second
time. I'm not sure what to do about this other then separate Issue and
Publication into separate loops entirely.

As always, your thoughts are appeciated greatly.
---------------------------Start script

Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
IssueHoldField"]

If["Status(CurrentMessageChoice = 1"]

if["IssueHoldField <=  0 OR not Exact("Condo Source", PublicationHoldField)
or not Exact("New Homes", PublicationHoldField)"]

Loop
Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
IssueHoldField"]

Exit Loop if["IssueHoldField > 0 AND
Exact("Condo Source",PublicationHoldField) or
Exact("New Homes", PublicationHoldField))
or
Status(CurrentModifierKeys)= 13"]

End Loop
End If
End If
---------------------------End script

PublicationHoldField and IssueHoldFields are global fields holding text and
numbers respectively.

0
Reply pcourterelle 9/15/2004 6:03:17 AM

You just need to enter some parenthesis so FileMaker knows in what order 
to evaluate your 'exit loop if' statement:

(IssueHoldField > 0 AND
(Exact("Condo Source",PublicationHoldField) or
Exact("New Homes", PublicationHoldField))) or
Status(CurrentModifierKeys)= 13

pcourterelle wrote:
> I am having a problem with the following script. Using FM 6 on Mac OS 9.
> The script is supposed to check if the user has properly entered the correct
> publication and an issue number that is greater than zero. The publication
> must be entered as either Condo Source or New Homes, any other variation is
> unacceptable.
> 
> Example: 
> Condo Source
> 12
> Result: No problem
> 
> Example
> New Homes
> 12
> Result: This result is not recognized as valid and loop cycles, asking you
> to re-enter the correct data. If you hit enter again without changing
> anything or simply enter inthe exact same information, it passes the exit
> loop test and life goes on. In short it passes the exit loop test only after
> the second cycle.
> 
> I think the problem is the second "or" statment in the exit loop. This
> statement/expression is not being evaluated until the loop cycles the second
> time. I'm not sure what to do about this other then separate Issue and
> Publication into separate loops entirely.
> 
> As always, your thoughts are appeciated greatly.
> ---------------------------Start script
> 
> Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
> IssueHoldField"]
> 
> If["Status(CurrentMessageChoice = 1"]
> 
> if["IssueHoldField <=  0 OR not Exact("Condo Source", PublicationHoldField)
> or not Exact("New Homes", PublicationHoldField)"]
> 
> Loop
> Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
> IssueHoldField"]
> 
> Exit Loop if["IssueHoldField > 0 AND
> Exact("Condo Source",PublicationHoldField) or
> Exact("New Homes", PublicationHoldField))
> or
> Status(CurrentModifierKeys)= 13"]
> 
> End Loop
> End If
> End If
> ---------------------------End script
> 
> PublicationHoldField and IssueHoldFields are global fields holding text and
> numbers respectively.
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 883-2846
FM Pro Solutions       Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance
0
Reply Howard 9/15/2004 7:21:30 AM


In article <BD4AEF08.2565%pcourterelle@telus.net>, pcourterelle
<pcourterelle@telus.net> wrote:

> I am having a problem with the following script. Using FM 6 on Mac OS 9.
> The script is supposed to check if the user has properly entered the correct
> publication and an issue number that is greater than zero. The publication
> must be entered as either Condo Source or New Homes, any other variation is
> unacceptable.
> 
> Example: 
> Condo Source
> 12
> Result: No problem
> 
> Example
> New Homes
> 12
> Result: This result is not recognized as valid and loop cycles, asking you
> to re-enter the correct data. If you hit enter again without changing
> anything or simply enter inthe exact same information, it passes the exit
> loop test and life goes on. In short it passes the exit loop test only after
> the second cycle.
> 
> I think the problem is the second "or" statment in the exit loop. This
> statement/expression is not being evaluated until the loop cycles the second
> time. I'm not sure what to do about this other then separate Issue and
> Publication into separate loops entirely.
> 
> As always, your thoughts are appeciated greatly.
> ---------------------------Start script
> 
> Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
> IssueHoldField"]
> 
> If["Status(CurrentMessageChoice = 1"]
> 
> if["IssueHoldField <=  0 OR not Exact("Condo Source", PublicationHoldField)
> or not Exact("New Homes", PublicationHoldField)"]
> 
> Loop
> Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
> IssueHoldField"]
> 
> Exit Loop if["IssueHoldField > 0 AND
> Exact("Condo Source",PublicationHoldField) or
> Exact("New Homes", PublicationHoldField))
> or
> Status(CurrentModifierKeys)= 13"]
> 
> End Loop
> End If
> End If
> ---------------------------End script
> 
> PublicationHoldField and IssueHoldFields are global fields holding text and
> numbers respectively.

You could be right, it looks like it's that 'End Loop' test with the OR
playing up - although there looks like a typo above with a missing /
extra bracket somewhere there. 

With your line you've got a test of:

    If A and B or C or D

which FileMaker will read as (A and B) or C or D.
ie.      Issue > 0 and Publication = "Condo Source
      or Publication = "New Homes"
      or ModifierKey = 13


When what you really want is:

    If A and (B or C) or D    

or written even more readably as:
   
    If (A and (B or C)) or D

{You could even spell it out in full as (A and B) or (A and C) or D.}


Putting in the extra brackets to ensure the correct testing order means
what get something like this:

    Exit Loop If[(
                  (IssueHoldField > 0) 
                 AND
                  (Exact("Condo Source",PublicationHoldField)
                      OR Exact("New Homes", PublicationHoldField))
                 )
                 OR Status(CurrentModifierKeys)= 13]




Helpful Harry                   
Hopefully helping harassed humans happily handle handiwork hardships  ;o)
0
Reply Helpful 9/15/2004 7:50:37 AM

Howard, Harry;

I agree that the problem is ensuring FM reads the exit loop as

A or 
(B or C) or 
D 

Where (B or C) is considered a distinct value from A or D.
I played with the parentheses as you recommended  and in other
configurations as well, but no change. I am going to separate the entire
loop into two parts, one for checking whether or not the Issue is greater
than zero and a second loop for checking the publication entered. Of course
if they introduce a third publication I will have to revist this issue.

FYI I am using FM6 on Mac OS9


in article 10kfrc0q4bdcuaa@corp.supernews.com, Howard Schlossberg at
howard@antispahm.fmprosolutions.com wrote on 9/15/04 1:21 AM:

> You just need to enter some parenthesis so FileMaker knows in what order
> to evaluate your 'exit loop if' statement:
> 
> (IssueHoldField > 0 AND
> (Exact("Condo Source",PublicationHoldField) or
> Exact("New Homes", PublicationHoldField))) or
> Status(CurrentModifierKeys)= 13

0
Reply pcourterelle 9/16/2004 1:49:34 AM

Ok, here's one solution. I created a standard calculation field called
RolloverValidityTest with the following parameters:

If(
Exact("Condo Source", PublicationHoldField) xor
Exact("New Homes", PublicationHoldField), "True",
"False"
)

This transfers part of the exit loop script to a calculation field that
displays either True or False. The simplified exit loop now tests if
IssueHoldField > 0 AND RolloverValidityTest = "True" before exiting loop.

Not the greatest solution but it works. If you have other ideas why the
orginial didn't work,I'd appreciate the post.

thanks for the input

phil courterelle

in article 150920041950377207%helpful_harry@nom.de.plume.com, Helpful Harry
at helpful_harry@nom.de.plume.com wrote on 9/15/04 1:50 AM:

> In article <BD4AEF08.2565%pcourterelle@telus.net>, pcourterelle
> <pcourterelle@telus.net> wrote:
> 
>> I am having a problem with the following script. Using FM 6 on Mac OS 9.
>> The script is supposed to check if the user has properly entered the correct
>> publication and an issue number that is greater than zero. The publication
>> must be entered as either Condo Source or New Homes, any other variation is
>> unacceptable.
>> 
>> Example: 
>> Condo Source
>> 12
>> Result: No problem
>> 
>> Example
>> New Homes
>> 12
>> Result: This result is not recognized as valid and loop cycles, asking you
>> to re-enter the correct data. If you hit enter again without changing
>> anything or simply enter inthe exact same information, it passes the exit
>> loop test and life goes on. In short it passes the exit loop test only after
>> the second cycle.
>> 
>> I think the problem is the second "or" statment in the exit loop. This
>> statement/expression is not being evaluated until the loop cycles the second
>> time. I'm not sure what to do about this other then separate Issue and
>> Publication into separate loops entirely.
>> 
>> As always, your thoughts are appeciated greatly.
>> ---------------------------Start script
>> 
>> Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
>> IssueHoldField"]
>> 
>> If["Status(CurrentMessageChoice = 1"]
>> 
>> if["IssueHoldField <=  0 OR not Exact("Condo Source", PublicationHoldField)
>> or not Exact("New Homes", PublicationHoldField)"]
>> 
>> Loop
>> Show Custom Message["Enter Publication and Issue", "PublicationHoldField",
>> IssueHoldField"]
>> 
>> Exit Loop if["IssueHoldField > 0 AND
>> Exact("Condo Source",PublicationHoldField) or
>> Exact("New Homes", PublicationHoldField))
>> or
>> Status(CurrentModifierKeys)= 13"]
>> 
>> End Loop
>> End If
>> End If
>> ---------------------------End script
>> 
>> PublicationHoldField and IssueHoldFields are global fields holding text and
>> numbers respectively.
> 
> You could be right, it looks like it's that 'End Loop' test with the OR
> playing up - although there looks like a typo above with a missing /
> extra bracket somewhere there.
> 
> With your line you've got a test of:
> 
> If A and B or C or D
> 
> which FileMaker will read as (A and B) or C or D.
> ie.      Issue > 0 and Publication = "Condo Source
> or Publication = "New Homes"
> or ModifierKey = 13
> 
> 
> When what you really want is:
> 
> If A and (B or C) or D
> 
> or written even more readably as:
> 
> If (A and (B or C)) or D
> 
> {You could even spell it out in full as (A and B) or (A and C) or D.}
> 
> 
> Putting in the extra brackets to ensure the correct testing order means
> what get something like this:
> 
> Exit Loop If[(
> (IssueHoldField > 0)
> AND
> (Exact("Condo Source",PublicationHoldField)
> OR Exact("New Homes", PublicationHoldField))
> )
> OR Status(CurrentModifierKeys)= 13]
> 
> 
> 
> 
> Helpful Harry    
> Hopefully helping harassed humans happily handle handiwork hardships  ;o)

0
Reply pcourterelle 9/16/2004 4:31:15 AM

4 Replies
155 Views

(page loaded in 0.156 seconds)

Similiar Articles:













7/21/2012 7:36:12 PM


Reply: