script to print values in certain fields? - InfoPath Dev
in

InfoPath Dev

script to print values in certain fields?

Last post 11-16-2005 07:35 AM by Matt Faus. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-14-2005 10:22 AM

    • Nick
    • Not Ranked
    • Joined on 06-17-2005
    • Posts 10

    script to print values in certain fields?

    I'm not very familiar with VB script....was hoping someone knows a quick easy way to do this: (I've already tried using the print views and that won't suffice).

    I need code that when a button is pressed it calls up and prints out the values in only the fields I tell it to. For example a user hits the button it pulls the info from fields "CUSTOMER_PO_NUMBER" "CUSTOMER_NAME" "CUSTOMER_ADDRESS" etc. etc. and pops up this info so they can print it to a thermal printer.

    hope this makes sense.....if anyone can help or point me in the right direction it would be much appreciated!

    Nick
  • 11-14-2005 10:29 AM In reply to

    Re: script to print values in certain fields?

    Hi Nick,

    Can you tell us why a separate Print View doesn't work for you? It looks like this combined with code behind should do the trick.

    Regards,

    Franck Dauché
  • 11-14-2005 10:36 AM In reply to

    • Nick
    • Not Ranked
    • Joined on 06-17-2005
    • Posts 10

    Re: script to print values in certain fields?

    Frank,
    I have a repeating section that has information in it...if I use a print view and only want to print the first set of information it will still print out everything in that repeating section. I need a way to..for example...if there are 4 sections and a button is pressed inside that section it will print out just that one set of info.
  • 11-14-2005 11:54 AM In reply to

    Re: script to print values in certain fields?

    Hi Nick,

    In your print view (assuming that you are starting from the same UI as the data entry side), you can change your repeating section to a regular section (Right-click / Changed To). Doing this, only the first instance of your data will be displayed. You can modify the print view this way to fit your needs.

    Does it make sense?

    Regards,

    Franck Dauché
  • 11-14-2005 01:33 PM In reply to

    • Nick
    • Not Ranked
    • Joined on 06-17-2005
    • Posts 10

    Re: script to print values in certain fields?

    thanks again franck.....it makes sense but doesn't seem to be working.....I think what I'm trying to get out of this is a little more complicated than I'm explaining. I might just need to hire a programmer to do it for me! hahaha
  • 11-14-2005 03:12 PM In reply to

    Re: script to print values in certain fields?

    You are in luck...I am available...hahaha.

    Try to drag-n-drop your repeating section on your form (while right-clicking with your mouse). In the "Select a Control" menu that appears on the screen pick "Section". You will now have an empty section on your form. Drop the fields from your schema inside that section. Should work as I described in my previous post.

    Regards,

    Franck Dauché
  • 11-16-2005 07:35 AM In reply to

    Re: script to print values in certain fields?

    Haha, throwing the word "hire" around in a place like this is sure to grab some attention - I'm available too!

    Anyways, I'm kind of thinking about this as a "Rolodex" kind of situation where you have a repeating section with several fields and a button in each one. What you could do is have a hidden field in the repeating section that would act as a "sentinel" and put code behind the button that would change the sentinel value to enable printing of the specific section (contact in the rolodex example). Say you have fields Name, Address, Phone, and Email, you would add one more - PrintEnable. Now the code in the button would put a true in the PrintEnable field (you could also do this with rules), switch views, print, and finally set PrintEnable back to false (you might even want to switch back to your original view). The other view that you would make would be a repeating section bound to the same nodes in the data source as the one on the main page where you have all of them, except you would filter the ones that it selects to display only the ones where PrintEnable == true. Since the only way PrintEnable will become true is when you press the button you know that this section will only have one contact in it.

    I hope this makes sense.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.