GManNAtl Posted February 18, 2013 Posted February 18, 2013 I have a standard government form that I would like to auto-populate that has boxes for each letter as many have seen. The original PDF is not an active form, nor do I want to mess around with Acrobat. Even if I did I think I would run into the same issue of putting one character in each box. So, I have converted the PDF to a JPG cleaned it up / resized it and have it on a layout that I want to populate with FM data. Obviously, I can't just drop the fields on the layout because the text doesn't line up with the boxes. I tried playing with font sizes etc., but without control over character spacing I can't line them up. So, my idea was to create a custom function that would break the name down into a repeating field with each letter of the name in the repeating fields. Then simply layout each character and show the appropriate repetition. Here is the CF that I wrote : Let ([ numOfCharacters = Length(yourtext); firstChar = Left(yourtext ; 1); remainingChars = Right(yourtext; Length(yourtext) - 1) ]; firstChar & ¶ & If ( Length ( remainingChars) > 0 ; TextToRepeat (remainingChars) ; "" ) ) I then called this function from in a repeating calculation field passing the name into it. The characters break out as expected, but just become list values in the first repetition. I have read many posts about reps, but can't get my head around populating them in this way, maybe it just can't be done? I suppose I could create a related table with a field for each character or something, but just wanted to keep it as clean as possible. I am open to a completely different idea if you have done something like this in the past as well. Thanks as always!
doughemi Posted February 18, 2013 Posted February 18, 2013 How about a script: Set Variable[$ctr; 1] Loop Set Field[Formfiller[$ctr]; Middle(Name; $ctr; 1)] Set Variable[$ctr; $ctr+1] Exit Loop If[$ctr>Length(Name)] End Loop Where Formfiller is your repeating field, and Name is the field containing the data to insert. Repeat as necessary for each field in the form.
GManNAtl Posted February 18, 2013 Author Posted February 18, 2013 I think you may be correct that this is the easiest thing to do. I use reps like anyone for layout design etc, but anytime I try to do anything like this which I feel is an appropriate use of them I just have issues! The only thing I didn't disclose is that obviously there are more than just the name to populate, so there will be a bit of scripting to do before entering this layout. The idea of just having info stored seemed more appealing, but hey I can script all of this in less time and probably save some hair at the same time. Thanks doughemi,
doughemi Posted February 18, 2013 Posted February 18, 2013 You can use the same script over and over by passing it a parameter. If you pass a parameter formfield|datafield, you can parse that: Set Variable[$param; Get(ScriptParameter)] Set Variable[$pipepos; Position($param;"|";1;1)] Set Variable[$formfield; Left($param; $pipepos - 1)] Set Variable[$datafield; Right($param; Length($param) - $pipepos)] Set Variable[$ctr; 1] Loop Set Field[$formfield[$ctr]; Middle($datafield; $ctr; 1)] Set Variable[$ctr; $ctr+1] Exit Loop If[$ctr>Length(datafield)] End Loop Then you could have an OnObjectExit script trigger on each data field with the trigger script building the script parameter and passing it to the subscript above.
Recommended Posts
This topic is 4295 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 accountSign in
Already have an account? Sign in here.
Sign In Now