6 Replies Latest reply on Dec 17, 2012 2:38 PM by philmodjunk

    pop-up / open a pdf from a container field using a variable

    linuxpad

      Title

      pop-up / open a pdf from a container field using a variable

      Post

                I am looking to pop-up or open a pdf file using a stored container field.  What I would like to do is make a certain pdf file pop-up once the id(number) has been typed into a field.  The user would then be required to read and close out the pdf file before they can go on to the next field.

                The number field called portal::s_number I am referencing is in a portal, but all the pdf files are not in this field.  I know the container field cannot be in a portal.

                They are in another table and field called documents::pdfs.  I have another id field called pdf_number, this is the field I am referencing to open the document.

                So basically when portal::s_numer =2, then open documents::pdf_number=2..  I only want to open specific pdf's.  So if a users types 4, nothing will happen if there is not a pdf.

                From my understanding so far it appears I will need to use the export field contents in a script just not sure how..

                I need help with setting and passing the variables..  

                Any help would be greatly appriciated..

                JP

            

        • 1. Re: pop-up / open a pdf from a container field using a variable
          philmodjunk
               

                    I know the container field cannot be in a portal.

               Not exactly. An interactive container field will not function as an interactive container field in a portal. But you can place the container field in the portal if you want, you just can't read the pdf page by page in it.

               You have two options here.

               Export Field Contents can be used to open the PDF, or you can pop up a new window with a container field optimized for interactive content.

               If you have a relationship such that:

               portal::s_numer = documents::pdf_number

               Then:

               Open in Adobe or whatever Default PDF reader app is specified for your computer:

               Set Variable [ $Path ; value: "file:" & Get ( TemporaryPath ) & "PdfFile.PDF" ]
               Export Field Contents [ documents::PDFcontainer ; $Path ]

               Open in new floating window with interactive container field:

               Go To Related Record [Show only related records; From table: documents; Using layout: "PFInteractive" (documents) ; New Window]

          • 2. Re: pop-up / open a pdf from a container field using a variable
            philmodjunk

                 Oh yes, and both of these scripts could be performed by clicking a button placed in the portal row.

            • 3. Re: pop-up / open a pdf from a container field using a variable
              linuxpad

                   Phil-

                   Thanks for the quick reply..  The relationship I have with the portal is not portal::s_numer = documents::pdf_number. 

                   I am using an ID field and sub ID.  I am using this to relate it as the records as they get created. So with that said I will need to pass the s_number to the documents and use that number.

                   How can I pass the s_number using the same Set Variable command?  So like??

                   Set Variable [$s_number; Value:Portal::s_number]

                   then pass the $s_number to the export field contents??

                   Set Variable [ $Path ; value: "file:" & Get ( TemporaryPath ) & "PdfFile.PDF" ]

                   The s_number field is just a number, the documents are actually in the pdfs field..??

                   Export Field Contents [ documents::$s_number ; $Path ]

                    

              • 4. Re: pop-up / open a pdf from a container field using a variable
                philmodjunk
                     

                          The relationship I have with the portal is not portal::s_numer = documents::pdf_number.

                     You are correct that this is not the relationship to use for the portal. This is the relationship you need for the script to work when you click the button in the portal row to view the enlarged PDF file--either opened via Export fields or popped up in a new window with an interactive container field.

                     With that relationship, there is no need to pass any values in a variable.

                     Your relationships would look like this:

                     LayoutTableOccurrence------<PortalTableOccurrence-----<Documents

                • 5. Re: pop-up / open a pdf from a container field using a variable
                  linuxpad

                       Phil-

                       Awesome!!!  Yes you are correct.. works like a champ!!

                       Here is what I did..  I added a little more to it..

                       I basically put 

                       If [portal::s_number=document::number]

                       Set Variable [ $Path ; value: "file:" & Get ( TemporaryPath ) & "PdfFile.PDF" ]
                       Export Field Contents [ documents::PDFcontainer ; $Path ]

                       Else

                       End If

                        

                       That way if  then document does not exists nothing happens..

                       woot...

                       Thanks Phil...

                  • 6. Re: pop-up / open a pdf from a container field using a variable
                    philmodjunk

                         You can remove the Else and get the same results.