Skip to main content
Known Participant
October 31, 2022
Question

Entries into one field from multiple fields based on a common field

  • October 31, 2022
  • 1 reply
  • 1314 views

I have a form in which I keep track of my weekly trips. I have one section of 10 lines with 5 fields; trip number, line haul, fsc, permits and net. I have a second section (Permits) with 6 lines of 5 fields; trip number, state, permit number, gross, net. If I enter the cost of a permit in the gross field in the Permits section, I need it to populate the permit field in the first section with the same trip number plus $15. The challenge here is that the first entry in the permit section may need to populate any of the gross fields in the first section and there may be more than 1 permit section entry for that field. Hopefully I've explained this well enough.

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
November 1, 2022

The multiple sections and multiple lines add some some complexity to the behavior of your form. So, we're going to need a clearer explanation.  What would help would be if all the sections where named. Then rather than saying first section, you'd use the section name, like you have for Fuel and Permits. Also you need to be very clear about the fields. At first you say that the Gross field is entered manually in the Permit section. These are the only fields with a colum header of "Gross".  Then you say that first entry in the permit section may need to populate a "Gross" field in the first section, where there is no Gross column. I think you mean to say that a Gross field in the permit section may need to populate more than one Permit field in the first section. I'm sure this is all clear to you, but for us the complexity of this form requires exact language.

 

So you are implying that multiple lines in the first section may have the same trip#? Since it is the trip number that connects the lines in the different sections. Does also that mean that more than one line in the Permit section may have the same trip#?  What happens when multiple Gross fields reference the same trip# and therefore the same permit fields in the first section?  

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
November 1, 2022

It's a work in progress and I've made some changes. I've uploaded the current version.

 

The upper most section is for the general trip information. This is where I enter the trip number which will auto-populate the Trip Number in the "Revenue" section. The Revenue section is what I had previously refered to as the first section. There is only one unique trip number for each trip. There are 2 pertinent sections; Revenue and Permits. The Revenue section lists what each individual trip pays. In this section I am trying to populate the permits fields. There are 10 so lets call them Permits 1 thru 10. The information for these comes from the Costs fields in the "Permits" section. There are 6 of these fields. We'll call them Cost 1 thru 6. Unlike the Revenue section, the Permits section may contain identical Trip Numbers because there may be more than one permit for a single trip. Whichever Cost fields in the Permits section need to be calculated into the single Permits field in the Revenue section with the same Trip Number. That would be (Cost + $15) * 0.7. If there is more than one then it would be (Cost1 + $15) *0.7 + (Cost2 + $15) * 0.7, so on and so forth. I aslo need the Permits fields in the Revenue Section to be blank if there are no permits for that trip.

 

I hope this clears up any confusion and misunderstanding.

Thom Parker
Community Expert
Community Expert
November 1, 2022

Yes it does.  But it's also not a simple request. 

And have you noticed that this file is huge.  The reason is that the Form dictionary contains font definitions for 50 different fonts that are not used anywhere on the form. I would suggest you start over. Create the form design in Word, convert to PDF and then copy over the real fields. This will give you a clean starting PDF. 

 

Now how much coding experience do you have, and how much do you want to learn?  

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often