Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

In non-Filemaker programming frequently the programmer will want to skip a whole section of code. This is normally done be entering an opening comment before the block of code and an ending comment after the block. In effect, this turns the whole chunk of commands into a comment.

This method, normally called "commenting out", is not available within Scriptmaker but there is another way easily skip a whole section of a script. You simply surround the section to be skipped with an IF statement that always validates false. Example:


If [1=2]

  Set Field [Table::Field; "This is the section"]

  Set Field [Table::Field; "of script steps"]

  Set Field [Table::Field; "that you want"]

  Set Field [Table::Field; "to skip"]

End If

In the above example you can see that when the script hits the IF statement it will evaluate as false because obviously 1 is not, and never will be, equal to 2. Therefore everything between the If and the End If is skipped.

I wish I could take credit for inventing this method but I can't. Its been around a long time but since a lot of FileMaker programmers are not full-time programmers this method may not be obvious so I thought I would highlight it as it often saves me a lot of time.

Posted

Good suggestion, Ted. I will frequently make the conditional something descriptive of the testing at hand; for example,

If ["use second method" = "true"]

...first method...

Else

...second method...

End If

Changing the conditional to

If ["use second method" <> "true"]

makes it a little easier for me to remember what exactly I'm getting at.

J

Posted

I couldn't help but chime in. A typical habit of mine is to use some number

e.g if [1 = 42] // which is false

if [0] is a good idea too.

this isn't bad either - it gives you a description and it never goes in the condition

if [ "only enable for test"]

Show Custom Message ["Hello World"]

end if

the text above is not true, so it never executes. So, the text itself is the condition which evaluates to false, so it serves as a comment too.

J__

  • 4 weeks later...
Posted

Note that although in FileMaker 7, If[ "only for test" ] evaluates as False, as does If[] (no calc specified), in FileMaker 6 both of those evaluate as TRUE. My preference: If[ 0 //insert comment here in FM7 ].

Posted

"if [ "only enable for test"]"

If the string began with "t" or "f" or "y" or "n" then it may have been different -- these are boolean values to FMP.

Posted

They removed that alpha boolean peculiarity in vs. 7.

I've heard many people took advantage of this twist in prior versions (myself included on a few occasions). I wonder if vs. 7 conversion took this into account and helped them identify those spots. I sure hope so!

LaRetta

Posted

Hmmm, I'm stuck in 6-think!

I might sit out FMP 7 and wait for FMP 8 to come along... I did that with FMP 3: went from 2.1 to 4.0!

Posted

Good morning, Vaughan!

Understood. Yep, Owner wasn't particularly tickled to hear a new version is coming so soon after investing in 7. I explained life to him ... it's progress and it's good. We hope we get a break on upgrading. But it's just like anything else in the tech world - it's obsolete the moment you purchase it - something much better and less expensive replaces it almost immediately. And that's always a good thing for consumers!

I keep eyeballing my NEW (and only) DVD purchase after just hearing it's being replaced with smaller (100x capacity) disks! I have to remind myself to smile anyway. wink.gif

LaRetta

  • 2 weeks later...
Posted

I usually use a global number field (gDebugging) that I can turn on or off for this purpose (if gDebugging=1 ...). But I would still prefer being able to comment out script steps on the fly. Or alternatively a command in the debugger for stepping over certain steps. Or a "watch" window showing values of certain fields during the script. Or ... alright, I'll restrain myself ;)

Peter

Posted

The debugger does have a "Set Next Step" button that lets you skip back or forward while running a script. You may also be interested in this article.

Posted

Hi Tom, thanks, you would think I'd be able to manage with only 8 icons in the Debugger interface, but I missed that one apparently :blush:

I've seen all the latest gossip about the upcoming V8 and I really hope Thinksecret is as accurate as in their predictions for 7 at the time. Tabs, table import/duplication, a watch window for the debugger, this is too much :)

Now, if they would only include ActiveX support for runtimes, I'd be truly ecstatic.

Peter

×
×
  • Create New...

Important Information

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