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

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

Recommended Posts

Posted

Another question that I feel I should know the answer to...but can't seem to remember! frown.gif

I'd like to be able to clear all repetitions of a repeating field. I've created payment matrix grid using records (rows) with a repeating field (columns). I'd like to be able to click a button and clear all repeating field values. I can step through the records (rows) using a simple loop, but I can't seem to figure out how to clear every repetition of the repeating field.

Thoughts?

Thanks!

-Rob

Posted

You can either hard-code each repetition in a set of Set Field scripts,

Set Field [repfield; ""]

Set Field [repfield[2]; ""]

Set Field [repfield[3]; ""]

etc.

or put repfield on a layout, formatted to display all repetitions and with a Tab order that travels sequentially through the repetitions. Put at at least one field after or before repfield, so that it is tabbed into after you tab out of the last repetition. Then

Go to Layout [layout with repfield]

Go to Field [repfield]

Loop

Set Field [ ; ""] <-- do not specify the field to be set

Go to Next Field

Exit Loop If [Get(ActiveFieldName) <> "repfield"]

End Loop

substituting your field name for repfield, of course.

Posted

I've created payment matrix grid using records (rows) with a repeating field (columns).

You mean Choose(.....GetRepetition kind of stuff, doesn't make sence any more if it ever have?? Use multi conditioned relations as well as sliced up portals. Before 7.0 was Lookup Next Higher a safer bet speedwise!!

--sd

Posted

Well in another thread came this reply ...only thing is that I came from relational databases to Filemaker, which apparently is the uncommon arrival to the tool as such:

One of the biggest advantages of Filemaker is the comparatively gentle learning curve, and part of the reason for that is the existence of repeating fields. There is a reason most newbies overuse repeating fields: fully understanding the concepts behind relational databases takes time, and repeating fields allows them to still create useable databases while learning.

I feel it's like giving brandy to an alcoholic - but I came to believe that a halfhearted attempts is better than nothing at all, from the new tune "Help Somebody" performed/written by the Van Zants Bros. (Skynard Lynard) ...so there isn't apparent no need to hessitate to throw this solution up Wave.gif ...where is the freeking Greamlin for snakeoil-salesman???

--sd

repClearTest.zip

  • 1 month later...
Posted

Hi,

this is another way...

Clear[select;repeatingField]

Loop

Go to Next Field

Clear[select]

Exit Loop If[Get(ActiveFieldContents)=Last(repeatingField)]

End Loop

Commit Records/Requests[No dialog]

Posted

Better to use Set Field than Clear, so that the Clipboard contents are left intact. Also, if the value in the last filled repetition is the same as the value in one of the previous repetitions, the loop will exit before completion.

Posted

Yes it's just two lines (tounge in cheek)

GTRR(SO)

Replace

This is a kindly hinting in direction of the existence of better structures sans repeating fields!!!!!!!!!!!!!!!!!!!!!!!!!!!

--sd

Posted

Hi JT,

I have always looked at the Clear Step as a simple Delete. The FileMaker help would seem to confirm this:

Deletes the contents of the specified field in the current record. Clear removes the contents of the field without placing the contents on the Clipboard. If you want to paste the field information, use the Cut script step. Use Undo immediately to restore the contents.

Lee

:cool:

Posted (edited)

if the value in the last filled repetition is the same as the value in one of the previous repetitions, the loop will exit before completion

No.

You have to try...

Whatever are the repeatition values, the loop stop always on the last rep. ;)

Edited by Guest
Posted

Interesting, Lee. I was not aware of that.

Daniele, I would think that is a bug or undocumented 'feature' which should not be relied upon in the future. Instead, a test using Get(ActiveRepetitionNumber) would probably be more reliable. It is very odd that Last appears to contain a pointer to the repetition number and not just its value though. :qwery:

Posted

Hey Queue, when did you pass 5000? I suppose it was 17 posts ago, but did I miss the party, or did we forget to throw one? You're so prolific! Congrats!

:yourock:

Posted

Hi JT,

I was trying to Edit my post before anyone else responded, but I have been having trouble with the site today, and had to restart my computer to ensure it wasn't me.

Unfortunately, it was in the middle of my post here. Sorry if this is "repeating" earlier information, or isn't germane to the subject at hand, but this is straight out of the Online Help.

The following example clears the values in a repeating field with three repetitions.

Clear [select, table::field(3)]

Clear [select, table::field(2)]

Clear [select, table::field]

Lee

Posted

Hi, Queue

I don't think that it is a bug...

Loop

Go to Next Field

Clear[select] -- now the Active field contains "" and this value isn't sure the same of the last value

Exit Loop If[Get(ActiveFieldContents)=Last(repeatingField) ] --but if the last is setted to "", than the loop stop

End Loop

BTW I think it is a nice feature for stopping a loop in a repeating field

Posted

It is very odd that Last appears to contain a pointer to the repetition number and not just its value

It doesn't. That's not how Daniele's script work. Here's another version of the same thing, but perhaps making the principle at work a bit clearer:

...

Loop

Go to Next Field

Clear[select]

Exit Loop If [ IsEmpty ( Last ( repeatingField ) ]

End Loop

Oh, and congrats on your 5K from me too! :party:

Posted

Lee, yes, I knew how Clear worked, but I did not know that it had no effect on the Clipboard. I wonder which is faster though, Clear or Set Field...

Mike, thanks! I didn't quite make my goal of 5000 in 2 years, but at least I was only a couple of weeks off. ;) If I hadn't stayed away for three months, I would have beat the goal. Oh well...

Comment, it took me a while, then I slapped myself in the head. I kept thinking the GTNF was after the Clear, in which case it made no sense to me. I must be getting slow in my prolificity. :idunno:

Posted

Lee, yes, I knew how Clear worked...

I knew that, and I wasn't trying to imply otherwise. I just thought it interesting how these steps had changed in version 7, when compared to v6. I don't know if I would have realized that you no longer need to use the "-" here, unless it beeps at you. I just don't use that many repeats.

Clear [select, "Repeating Field"]

Clear [select, "Repeating Field" -2]

Clear [select, "Repeating Field" -3]

However, this gives me an opportunity to increase my post count.

:woohoo:

Congratulations on your 5,xxx posts. I have learn a great deal because of your participation.

:yourock::thankyou:

Lee

:cool"

Posted

Very true. Also, GetRepetition( field, X ) now works as field[X], a long-overdue simplification, IMO.

I have learned a lot from you as well. You are quickly approaching 3500. So I daresay we'll be having your 5000th postiversary in the not-too-distant future. :grin:

And just because I can, :yay::chili: :yay:

This topic is 7064 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.