7 Replies Latest reply on Feb 26, 2015 2:57 PM by philmodjunk

    pasting the selected field from a pop up

    evansj2

      Title

      pasting the selected field from a pop up

      Post

      hello

      Working on an invoicing program and started with a template. I added a pop up that contains the account numbers associated with a specific client.

             
      1. 123456
      2.      
      3. 654321
      4.      
      5. 987654
      6.      
      7. Empty
      8.      
      9. Empty

      I would like to be able to select one of the account numbers and have it paste into the next available field in the Invoice. Currently its only pasting the first entry from the Pop up, not the one I selected. Also its pasting it into the 1st row.

      I've played with the following script for awhile and not had luck. Any ideas??

      Here is the script,

             
      1. Popover: Popover | Add Account Number[Get Script Parameter]
      2.      
      3. Allow User Abort [ Off ]
      4.      
      5. Set Field [ Invoices::Search ; "" ]
      6.      
      7. Set Field [ Invoices::account number ; "" ]
      8.      
      9. Perform Script [ “Trigger | Refresh Search” ]
      10.      
      11. Commit Records/Requests
      12.      
      13. [ No dialog ]
      14.      
      15. If [ not IsEmpty ( Get ( ScriptParameter ) ) ]
      16.      
      17. Set Variable [ $SELECTED_ITEM; Value:Get ( ScriptParameter ) ]
      18.      
      19. Else If [ GetLayoutObjectAttribute ( "select_account_pop" ; "IsFrontPanel" )
      20.      
      21. and
      22.      
      23. IsEmpty ( Get ( ScriptParameter ) ) ]
      24.      
      25. Set Variable [ $SELECTED_ITEM; Value:List (accounts::Account Num ; accounts::CUSTOMER ID MATCH FIELD) ]
      26.      
      27. Else
      28.      
      29. Exit Script [ ]
      30.      
      31. End If
      32.      
      33. Go to Object [ Object Name: "select_account_pop" ]
      34.      
      35. Close Popover
      36.      
      37. Go to Field [ Invoices::account number ]
      38.      
      39. Set Field [ Invoices::account number ; GetValue ($SELECTED_ITEM ; 1 ) ]

        • 1. Re: pasting the selected field from a pop up
          philmodjunk

          I have more questions than answers.

          What script parameter is passed to your script?

          what does the "Trigger | Refresh Search" script do?

          How is your layout designed? What does "the next field" mean? The next account number Field in a portal perhaps? Or does the script supposed to create a new record?

          • 2. Re: pasting the selected field from a pop up
            evansj2

            user is anyone with no password..

            • 3. Re: pasting the selected field from a pop up
              evansj2

              guess the FMP file didnt upload..

              i posted a copy of my file here if you want to have a look. the user is "anyone" and there isnt a password.

              http://mms.rpi.edu/temp/temp.html

               

               

              • 4. Re: pasting the selected field from a pop up
                philmodjunk

                I would rather have had answers to my questions. They not only provide me information about your design, but provide clues as to your level of understanding about FilMaker and Database design which then helps me better gauge how to phrase a suggestion.

                I don't have time now to examine your file, but do let me (or other interested parties) know the name of the layout where you have your Popover that isn't working so that we don't have to search through the solution to figure out which one to examine.

                • 5. Re: pasting the selected field from a pop up
                  evansj2

                  using the starter solution titled Invoice I added a tab for Account Numbers (next to Billing & Shipping Address on Customer Detail). When you create an invoice you add Line Items as usual but then there is an area for Account Numbers to charge. Looking at the image- you press the light green button and the  "select_account_pop" popup shows the accounts you have on record.What i want is to select any of the ones in the list and have it populate the next available row in the Account Nu,bers to Charge Section (shown behind the popup).

                  Whats happening is that it always pastes whatever you have in row one (Jim account 1) and always in the first row of the repeating field Account Numbers to Charge.

                  • 6. Re: pasting the selected field from a pop up
                    evansj2

                    also the refresh script is a simple setup script (came with the template).

                    If [ $$PLATFORM = "Desktop" ]
                    Refresh Window
                    [ Flush cached join results ]
                    Else
                    Set Field [ Invoice Data::INVOICE ID MATCH FIELD ; Invoice Data::INVOICE ID MATCH FIELD ]
                    End If

                    • 7. Re: pasting the selected field from a pop up
                      philmodjunk

                      Are those 5 different fields that you have inside your popover? Is each set up as a different button?

                      Your script refers to a script parameter. As I previously asked, what is passed to your script as a script parameter?

                      How did you design the account numbers to charge section? Is this a set of individual fields, one large text field or a portal to a set of related records?

                      I'd use a portal to list the accounts inside the popover, The field placed inside that portal row would be set up as a button and the script would set a variable to the value of data from that portal row. The script would then create a new related record in the "account numbers to charge portal" and this new record would automatically appear in the next available row in your portal to this table.

                      For more on using selection portals inside a popover, see: "Adventures in FileMaking #2 - enhanced value selection".