Tracey Webb Posted June 3, 2002 Share Posted June 3, 2002 Hi, I am trying to replace the contents of a repeating field and all the browsed set with a value from a second field. My problem lies in that I want it to copy to the Next blank repetition so as not to lose all previous information. Each record has a different no of repetitions in the field and naturally if I use the Replace Command it replaces everything in the same repetition number position of the field thus leaving blank repetitions or overprinting existing information. For various reasons I do not wish to use a portal. Is there some kind of script or calculation I can use to do this operation. In anticipation - Thanks Quote Link to comment Share on other sites More sharing options...
kitdcat Posted June 4, 2002 Share Posted June 4, 2002 I think I understand, but it is very complicated. You would have to create a loop script which go though your found set of records. Then the script would have to some how check to see if the repetion field was empty. If the field was not empty the loop script would send you to the next repetion or if the repetion was empty it would set the field with the content from the other field. Quote Link to comment Share on other sites More sharing options...
coolboy7163 Posted June 4, 2002 Share Posted June 4, 2002 Kidkat, That would not work because a repeting field is looked at as one field, and if you try to check if it is empty it will look at the entire contents of the field giving you the incorrect response. God bless you! Quote Link to comment Share on other sites More sharing options...
andygaunt Posted June 4, 2002 Share Posted June 4, 2002 coolboy, not quite true. you can script it to do the following. Requires a global counter field (_gCounter, number format) Make sure you have the found set you require before running the script. Freeze Window Go To Layout [ Layout with repeating field on ] Go To Record/Request/Page ["First"] Loop Go To Field ["Repeating Field"] Set Field ["_gCounter", Status(CurrentRepetitionNumber)"] Loop If ["IsEmpty(GetRepetition( Repeating Field, _gCounter))"] ##Do what you want with this first empty repetition Exit Script Else Go to next field Set Field ["_gCounter", "Status(CurrentRepetitionNumber)"] End If End Loop Go To Record/Request/Page ["Next, Exit After Last"] End Loop Works best if you go to a layout that only has the repeating field on it. HTH Quote Link to comment Share on other sites More sharing options...
Tracey Webb Posted June 5, 2002 Author Share Posted June 5, 2002 Thanks Andy - Your script runs but has a few glitches - Here is the script I tried Freeze Window Go To Layout [ "Form" ] Copy [select, "Key"] Go To Layout [ "with Letter Type Only" ] Go To Record/Request/Page ["First"] Loop Go To Field ["Letter Type"] Set Field ["_gCounter", Status (CurrentRepetitionNumber)"] Loop If ["IsEmpty(GetRepetition( Letter Type, _gCounter))"] Paste [select] Omit Record Else Go to next field Set Field ["_gCounter", "Status(CurrentRepetitionNumber)"] End If End Loop Go To Record/Request/Page ["Next, Exit After Last"] End Loop You may note I had to remove "Exit Script" & Replace it with "Omit Record" as it was Stopping after the first record. Also, it the field has one or less repetitions, it skips the record with the new data all together. When the Script is finished the egg timer stays onscreen until I hit Esc, So I do not really know when the script is over. Thanks for you help. Thanks also to the others who left a post Quote Link to comment Share on other sites More sharing options...
andygaunt Posted June 5, 2002 Share Posted June 5, 2002 Hi Tracey, sorry for the glitches. I just threw that one together off the top of my head to show it can find a blank repetition. As to why the script is sitting there with the egg timer I think you will find that is due to the fact that you omit your records. when it is finished and you press ESC do you have any found records left. If not that is why it is not stopping, as it only exits when it sees it has reached the last record. If no records are there it doesnt know. You shouldnt have to omit the records, if you do it will skip a record through the script with the Go to record ["next, exit after last"]. If you leave in your omit record line you will want to remove the go to record request page, next line and change it for a Exit Loop If [" Status(CurrentFoundCount)=0"] or something similar Glad we got the ball moving though. HTH Quote Link to comment Share on other sites More sharing options...
dj Posted June 5, 2002 Share Posted June 5, 2002 Here is an alternative script Firts create an layout "Repeat" with only your repeating field on it. Display all repeatitions of field. Leave tab order as default. Now create the script Go To Layout "Keyword" Copy [select, "Key"] Go To Field [""] Go to Layout "Repeat" Go To Record [first] Loop Loop Go To Next Field Exit loop If[status(CurrentFieldContents) = ""] End loop Paste [select] Go To Field [""] Go to Record [exit after last, next] End loop HTH You should also check if there is at all some empty repeatition (for example using some counter and changing the exit loop condition to Status(CurrentFieldContents) = "" or counter>totalNumberOfRepeatitions Dj Quote Link to comment Share on other sites More sharing options...
coolboy7163 Posted June 5, 2002 Share Posted June 5, 2002 Hello there, I tested the script written by Dj and that one works, try it like this.. Loop Copy [ Second Field ] [ Select entire contents ] Go to Field [ Repeating Field ] Loop Go to Next Field Exit Loop If [ Status(CurrentFieldContents) = "" ] End Loop Paste [ ] [ Select entire contents ] Go to Record/Request/Page [ Next, Exit after last ] End Loop Quote Link to comment Share on other sites More sharing options...
Tracey Webb Posted June 7, 2002 Author Share Posted June 7, 2002 Firstly - Thanks to all for your help but... I have tried DJ and Coolboys scripts however they both tend to post to the first repetition in the field. Andy, your script posts to the last (as required) except where there is no repetition or only one repetition in the field. I have tried endlessly different variations and changes to both to no avail. My frustration is now getting to me!!! So I am back asking for help. Basically what I am trying to do is keep a correspondence record on file for each client when I send them a letter/email and as this is done in bulk, I need to save the old fingers and keyboard and noting in each record that I have written to them(or not) a standard letter. Your replies are appreciated. Quote Link to comment Share on other sites More sharing options...
dj Posted June 7, 2002 Share Posted June 7, 2002 I don't know what have you done but the script I've sent you works just fine. I can tell so because I've tested it. Dj Originally posted by Tracey Webb:[qb]Firstly - Thanks to all for your help but... I have tried DJ and Coolboys scripts however they both tend to post to the first repetition in the field. Andy, your script posts to the last (as required) except where there is no repetition or only one repetition in the field. I have tried endlessly different variations and changes to both to no avail. My frustration is now getting to me!!! So I am back asking for help. Basically what I am trying to do is keep a correspondence record on file for each client when I send them a letter/email and as this is done in bulk, I need to save the old fingers and keyboard and noting in each record that I have written to them(or not) a standard letter. Your replies are appreciated.[/qb] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.