Jump to content

?Change field definition on a repeating field


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

Recommended Posts

Can anyone help? I need to change a field that was previous defined and used as a repeating field to a single text box. How can I do that and retain the information entered into the repeated field lines into the redefined field?

Thanks

Link to post
Share on other sites
  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

First, I would add a text field (or use one that's not currently in use) to hold the data temporarily. I'll call it temptext. Go to a layout that contains the repeating field (which I'll call repeatingfield and make sure the tab order is set to cycle through all repetitions of the field consecutively.

Then you can use the following script:

Show All Records

Go to Record/Request/Page [First]

Loop

[color:"white"]__Go to Field [repeatingfield]

[color:"white"]__Loop

[color:"white"]____Set Field [ temptext, temptext & Status(CurrentFieldContents) & "

Link to post
Share on other sites

Thanks for the quick reply. I actually kind of found my way there trying to use the GetRepetitions function with new field (one for each repetition) and then concatenating into one, but am struggling with my loop working.

I will try your script exactly as you've given it and see what comes up.

Thanks a bunch!

Link to post
Share on other sites

Just so you know, if you are setting a repetition in one field with the same repetition from another field, it is not necessary to use GetRepetition. FM assumes the repetitions are the same if you specify the Set Field one, unless you tell it otherwise. So Set Field ["repa"-5, repb] will set the fifth rep of repa with the fifth rep of repb. It's only if you require different reps that a GetRepetition is required, e.g. Set Field["repa"-5, GetRepetition(repb, 6) & ""]. The addition of & "" is required when using GetRepetition on text fields, due to a glitch.

Note also (just for fun) that Set Field ["repa"-1, GetRepetition(repb, 1) & ""] and Set Field ["repa"-1, repb] are both equal to Set Field [repa, repb].

Link to post
Share on other sites

It only came up with the data from the first repeating line? Here's what I ran

Show All Records

Go to Record/Request/Page [First]

Loop

Go to Field [Production Description]

Set Field [Description, Description & Status(CurrentFieldContents) & "paragraph mark"]

Go to Next Field

Exit Loop If [not Status(CurrentFieldName) = Production Description]

End Loop

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

End loop

What did I miss? I did tab set as you instructed. Any ideas?

thanks

Link to post
Share on other sites

Did you make your text field large enough to view all data in it? If you click in it, you should see the first line followed by the invisible return and subsequent repetition data below it.

Link to post
Share on other sites

thought i posted this once already, but here's my reply cause I don't see it.

Thanks. Yes both of those are a OK. I just didn't type the other Loop in my reply; it is after Go to Field [Product Description].

Any other ideas? Thanks again!

Link to post
Share on other sites

Ah, you need quotes around Production Description in the Exit Loop If step. Otherwise you are testing whether the current field name matches the value in Production Description. Since it doesn't ever (I would assume), the loop exits after one iteration.

Link to post
Share on other sites

Jana said:

Can anyone help? I need to change a field that was previous defined and used as a repeating field to a single text box. How can I do that and retain the information entered into the repeated field lines into the redefined field?/quote]Note that after doing this, you are going to have a problem. Filemaker remembers the content of what was in the field. Let's say repetition 2 of some record contained "oz". No other record contain this value. Convert the field. In the "oz" record, do NOT put "oz" in the updated field. Find "oz". It will continue to show this fantom value in finds and in the field index.

Link to post
Share on other sites

Good point! You'll want to change your field back to the number of repetitions it contained previously and loop through all repetitions greater than the first, setting them to null.

Show All Records

Go to Record/Request/Page [First]

Loop

Go to Field [repfield]

Go to Next Field

Loop

Set Field [, ""]

Go to Next Field

Exit Loop If [not Status(CurrentFieldName) = "repfield"]

End Loop

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

End Loop

I haven't tested this yet, so BACK UP your file first.

Note that you don't specify a field in the Set Field step, only the calculation of "".

Link to post
Share on other sites

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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