1 2 Previous Next 26 Replies Latest reply on Apr 24, 2016 1:10 AM by tays01s

    Dropdown, pop-up problem

    tays01s

      Following on from: https://community.filemaker.com/message/557619?et=watches.email.thread#557619

       

      I have a portal in which I have a pop-up for a product_fk_uuID and using a varlist base on Product_uuID, 2nd field Product name. It works fine in choosing 1 or more products (the fact it could be a list I assume removes the option of using a global field).

       

      To facilitate product choice I need to use a dd with auto-complete. However, I haven't found how to grab the Product_uuID when using the dd; instead, no matter what I choose from the list, it always resets to the first item in the list.

        • 1. Re: Dropdown, pop-up problem
          bigtom

          You can use the script trigger on the drop down to run something like this to set the product_fk_uuID field:

           

          ExecuteSQL ( "SELECT \"Product_uuID\" FROM \"ProductTableName\" WHERE \"Product Name\" = ?"; ""; ""; Table::DropDownField)

           

          I think this is the piece you are missing.

          • 2. Re: Dropdown, pop-up problem
            tays01s

            Some progress, thank you. The correct product and UUID are now set in the Table::DropDownField, BUT, it overwrite the first record in that table. If I make the dd change as part of a new field, it still sets the Table::DropDownField to the ProductName, but I guess that's simply the script missing this target record and hitting on the 1st record instead.

            • 3. Re: Dropdown, pop-up problem
              bigtom

              I think something is off if you are seeing the UUID and the name in the DD. You should only see the name.

              • 4. Re: Dropdown, pop-up problem
                tays01s

                Yes, I'd missed that. Just to re-check:

                1. Both pop-up and dd are fkProduct_UUID field.

                2. Pop uses value list based on UUID and 2nd field Product name from related Product table.

                3. dd uses same except only Product name. So yes, I don't know how UUID appears on exiting the fkProduct_UUID field.

                 

                One change. I'd had the ProductList:Product name (ProductList being the related table used in the portal) as a calc field. On changing it to text/auto-enter to get the name when fkProduct_UUID field is set, I found that the dd triggered script correctly sets the fkProduct_UUID field.

                 

                Outstanding issues:

                a. Not sure why the UUID appears instead of the name on exiting dd.

                b. Neither the pop-up button 'go to dd object' nor dd script 'go to popup object' work. Instead the portal row is merely as active.

                • 5. Re: Dropdown, pop-up problem
                  bigtom

                  This sounds far more complicated than it needs to be.

                   

                  If you can post/send a blank copy of your solution that just has the value list table values I can modify it and get it back to you.

                   

                  Did you select "show only value from second field" in your value list setup?

                  • 6. Re: Dropdown, pop-up problem
                    tays01s

                    The solution's rathers complicated and confidential, but will these value lists give the info? Thank you for looking at this. And yes, for the pop-up 2nd field is selected. For the dd only the 'Feed' is selected because I want to use 'auto-complete', the whole reason I'm putting myself through this in fact!

                    • 7. Re: Dropdown, pop-up problem
                      bigtom

                      If it is in a portal you do need to keep track of the portal row number and use the go to portal row script. It helps to give the portal an object name as well.

                       

                      If you don't it will default to the first row.

                       

                      The value lists look correct.

                      • 8. Re: Dropdown, pop-up problem
                        tays01s

                        If I have in a ProductList:: portal:

                        1. dd: Based on Product::name showing the name.

                        2. popup: Based on Product_fkID, 2nd field Product::name.

                         

                        3. Script: Uses your syntax format: ExecuteSQL ( "SELECT \"Product_uuID\" FROM \"ProductTableName\" WHERE \"Product Name\" = ?"; ""; ""; Table::DropDownField)

                         

                        I have tried setting a variable to Get(activerownumber) then after the above script IF Get(activerownumber) = $row variable, setting the List::Product fkID to the variable set from the ESQL.........but it doesn't work.

                         

                        Any ideas on how nailing the row number should be restructured?

                        • 9. Re: Dropdown, pop-up problem
                          bigtom

                          Do your portal, DD, and PopUp all have an object name?

                           

                          You were not very specific in your other post that this was operating in a portal.

                           

                          This setup might be easier for you to understand. I would suggest you get the DD popup functioning outside of the portal first so you can eliminate there being any issues from that process.

                           

                          Basic outline of setup.

                          Pop up has a button function that will set a global visibility flag variable. Not sure how this will work in a portal, but might be easier for you to do.

                           

                          The DD should be it's own field. Maybe ProductPortalDD?

                          Put the DD over the PopUp.

                          Hide dropdown when IsEmpty ( $$DropFlag )

                           

                           

                          PopUp script

                          Set Variable [ $$DropFlag ; Value: 1 ]      //not sure if this will unhide all dropdowns in the portal, but might not matter.

                          Set Variable [ $row ; Value: Get( activerownumber )]

                          Go to Object [ Object Name: "dropdown" ]      // This should get the dropdown in the active row since you are already there.

                           

                           

                          On object modify DD script trigger.

                          If [ not IsEmpty ( Table::ProductPortalDD ) ]

                              Set Field [ Table::fkProduct_UUID ; ExecuteSQL ( "SELECT \"IDpk\" FROM \"Table\" WHERE \"Name\" = ?"; ""; ""; Table::ProductPortalDD) ]

                          End If

                          Set Variable [ $$DropFlag ; Value: "" ]

                           

                           

                          Basic script for navigating to a portal row. Put this where you feel it might be appropriate.

                          Go to Object [ Object Name: "portal" ]

                          Go to Portal Row [ $row]

                          Go to Object [ Object Name: "popup" ]

                          • 10. Re: Dropdown, pop-up problem
                            tays01s

                            Thank you for the detailed guide.

                             

                            Both scripts run into a problem:

                            1. Pop: Debugger immediately flags that command is unavailable. I assume it's when setting variable for $$dd_flag:

                            Set Variable [ $$dd_flag; Value:1 ]

                            Set Variable [ $row; Value:Get ( ActivePortalRowNumber ) ]

                            Go to Object [ Object Name: "food_dd_2" ]


                            2. dd: This script doesn't set the fk)ID and at Go to Portal Row [ $row ] [ Select ] ask for a 'specify a record number'.


                            Set Variable [ $row; Value:Get ( ActivePortalRowNumber ) ]

                            If [ not IsEmpty ( FeedsUsed::Feed ) ]
                            Set Variable [ $feed_uuID; Value:ExecuteSQL ( "SELECT \"__uuID\" FROM \"Feeds\" WHERE \"Feed\" = ?"; ""; "";

                            FeedsUsed::Feed)

                            End If

                            Set Variable [ $dd_flag; Value:"" ]

                            Go to Object [ Object Name: "oral_intake" ]

                            Go to Portal Row [ $row ] [ Select ]

                            Go to Object [ Object Name: "food_pop_2" ]

                            Commit Records/Requests

                             

                            This has certainly turned out to be really difficult to code.

                            • 11. Re: Dropdown, pop-up problem
                              bigtom

                              Here is an example setup as I have explained. Hopefully this will help you.

                               

                              No portal row reference needed, But you can use it if you want, Why?

                              • 12. Re: Dropdown, pop-up problem
                                tays01s

                                I've shadowed the example. Still function doesn't appear correct.

                                Pop script:

                                Set Variable [ $$dd_flag; Value:1 ]

                                Go to Object [ Object Name: "food_dd_2" ]

                                correctly sets the $$dd_flag but the dd, with hide set to: $$dd_flag  ≠ 1, doesn't make the dd appear.


                                When I use the dd script trigger on exit dd:

                                If [ not IsEmpty ( FeedsUsed::Feed) ]

                                Go to Object [ Object Name: "food_pop_2" ]

                                Set Field [ FeedsUsed::_FeedsUUID; ExecuteSQL ( "SELECT \"__UUID\" FROM \"Feeds\" WHERE \"Feed\" = ?"; ""; "";

                                FeedsUsed::_FeedsUUID) ]

                                End If
                                Set Variable
                                [ $$dd_flag; Value:"" ]
                                for the 1 portal record FeedsUsed::Feed appears in data viewer then disappears along with the record from the portal. For subsequent records choosing a feed doesn't show in data viewer. At no time does the ESQL manage to set FeedsUsed::_FeedsUUID.


                                FeedsUsed layout records otherwise appear normal other than the first one not have a Feed name and none of them having FeedsUsed::_FeedsUUID.

                                 

                                 


                                 

                                • 13. Re: Dropdown, pop-up problem
                                  bigtom

                                  As you can see the example works.

                                   

                                  About the hiding, not sure what the issue is there. Is the DD over the PopUp?

                                   

                                  Your set field seems wrong. You should be using the dropdown field name and not a UUID as the variable parameter. Please review the example again. You are setting the field when it equals itself??

                                   

                                  You will not actually have a feed name set. The popup is a system to display the name when only the UUID is set. FeedsUsed::Feed should not be in your portal record, unless you set it specifically as a separate action.

                                   

                                  The only reason the records will drop out of the portal are if you do not have record creation by relationship selected, you are not setting the fk properly, one of your key fields is not auto enter, or a combination of these things.

                                   

                                  >

                                  • 14. Re: Dropdown, pop-up problem
                                    tays01s

                                    Just before I delve into the rest, I noticed that your example is related: A::pk < B::Akf >< VL::pk whereas mine is:

                                    Ppk < C::Pfk, [Table P is where the Feedsused portal resides]

                                    Cpk < I::Cfk,

                                    Ifk < Feedsused::Ifk,

                                    Feedsused::Feed fk > Feeds::pk

                                    1 2 Previous Next