1 2 Previous Next 15 Replies Latest reply on Jul 15, 2013 9:50 AM by AppGuy

    Portal with button that checks another table for status

    AppGuy

      Title

      Portal with button that checks another table for status

      Post

           Before I begin I did have another post but checked it as done so I can reposting since it's not working exactly how I expect it.

           Here is the last post: Portal with Unique checkbox per user

           I have attached my relationship graph..

           This issue I am having is... after a person signs in..  they click the review tab...  this currently goes to the peronnel_signin table with a portal from the jsa_portal. (Works fine)

           There is a button on the portal that I would like the person that is signed in to be able to review any of the rows in the portal.

           This kinda works.. they click the review button and it logs the review.  They next person comes and signs in and they see they record has already been reviewed.  It seems to be recording the review by jsa_portal instead of by personnel_signin..??

           Here is the script:

      Allow User Abort [ Off ]
      If [ IsEmpty(Touch_Rate::Touch_Rate_Check_SOP) ]

      Set Variable [ $portal_id; Value:jsa_portal::id ]
      Set Variable [ $personnel_id; Value:personnel_signin::personnel_id ]
      Set Variable [ $jsa_id; Value:personnel_signin::jsa_id_sub ]
      Freeze Window
                          Go to Layout
      [ “Touch_Rate_Table” (Touch_Rate) ]
      New Record/Request
                          Set Field
      [ jsaportal_TOUCHRATE_review::_fkJSA; $jsa_id ]
      Set Field [ jsaportal_TOUCHRATE_review::_fkPersonnelSignIn; $personnel_id ]
      Set Field [ jsaportal_TOUCHRATE_review::_fkJSAPortal; $portal_id ]
      Set Field [ jsaportal_TOUCHRATE_review::Touch_Rate_Check_SOP; "1" ]
      Go to Layout [ original layout ]
                           

      Else If [ Touch_Rate::Touch_Rate_Check_SOP = 1 ]
      Show Custom Dialog [ Title: "Remove Touch"; Message: "Are you sure you want to remove this review?"; Default Button: “Yes”, Commit: “Yes”; Button 2: “No”, Commit: “No” ] If [ Get (LastMessageChoice) =1 ]

                           

      Go to Related Record [ From table: “Touch_Rate”; Using layout: “Touch_Rate_Table” (Touch_Rate) ] [ Show only related records ]

      Delete Record/Request

      [ No dialog ]

      Go to Layout [ original layout ]

      End If

      End If

            

      Screen_Shot_2013-06-20_at_10.14.26_AM.png

        • 1. Re: Portal with button that checks another table for status
          AppGuy

               Here is a screenshot of the portal view and button...

          • 2. Re: Portal with button that checks another table for status
            philmodjunk

                 I can't quite decipher the relationship details. What are the match fields that link Personnel_SignIn to jsa_form?

                 This part of your script is definitely problematic:

            Go to Layout[“Touch_Rate_Table” (Touch_Rate)]
            New Record/Request
                 Set Field
            [jsaportal_TOUCHRATE_review::_fkJSA; $jsa_id]
            Set Field[jsaportal_TOUCHRATE_review::_fkPersonnelSignIn; $personnel_id]

                 You change layouts without your script doing anything to select a specific record in Touch_Rate. You might be on a completely incorrect record. Then, from the context of Touch_Rate, your script modifies fields in a related table via the jsaportal_TOUCHRATE_review table occurrence. That could be the completely wrong record due to possibly being "on" the wrong Touch_Rate record. if jsaportal_TOUCHRATE_review is an occurrence of Touch_Rate, it looks like you are on the wrong layout for your set field steps to be modifying data in jsaportal_TOUCHRATE_review.

                 GIven that you have a chain of table 4 occurrences between TouchRate and jsaportal_TOUCHRATE_review, there are any number of ways that this could go wrong with those set field steps.

            • 3. Re: Portal with button that checks another table for status
              AppGuy

                   Phil-

                   Sorry for the confusion.. I have been modifing the script so much to try various different things to get this to work..

                   Relationships:

                   jsa_form ---<personnel_signin

                   jsa_form---<jsa_portal

                   I can put the touch_rate in here but it's prob not right...  It appears to be a relationship issue I just am drawing a complete blank..

                   I have another table called touch_rate where I was planning on creating the reviews.. 

                   Given the relationship above.. when  a person signs into the personnel_signin...  they click a button that takes them to another layout based on the personnel_signin table with a portal from the jsa_portal.

                   Then there is a button in this portal (as seen above).  This is where I would like each person to be able to review each portal record.

                   Let me know if this makes sense or if you need more info..??

                    

              • 4. Re: Portal with button that checks another table for status
                AppGuy

                     Here is another script I was testing with as well..

                Allow User Abort [ Off ]
                If [ IsEmpty(Touch_Rate::Touch_Rate_Check_SOP) ]

                Set Variable [ $$portal_id; Value:jsa_portal::id ]
                Set Variable [ $personnel_id; Value:personnel_signin::personnel_id ]
                Set Variable [ $jsa_id; Value:personnel_signin::jsa_id_sub ]
                Freeze Window
                                    Go to Layout
                [ “Touch_Rate_Table” (Touch_Rate) ]
                New Record/Request
                                    Set Field
                [ Touch_Rate::_fkJSA; $jsa_id ]
                Set Field [ Touch_Rate::_fkPersonnelSignIn; $personnel_id ]
                Set Field [ Touch_Rate::_fkJSAPortal; $$portal_id ]
                Set Field [ Touch_Rate::Touch_Rate_Check_SOP; "1" ]
                Go to Layout [ original layout ]
                // Show Custom Dialog [ Title: "Touch"; Message: "Your Touch has been logged."; Default Button: “OK”, Commit: “Yes” ]

                Else If [ Touch_Rate::Touch_Rate_Check_SOP = 1 ]
                Show Custom Dialog [ Title: "Remove Touch"; Message: "Are you sure you want to remove this review?"; Default Button: “Yes”, Commit: “Yes”; Button 2: “No”, Commit: “No” ] If [ Get (LastMessageChoice) =1 ]

                // Go to Layout [ “Touch_Rate_Table” (Touch_Rate) ]

                Go to Related Record [ From table: “Touch_Rate”; Using layout: “Touch_Rate_Table” (Touch_Rate) ] [ Show only related records ]

                Delete Record/Request

                [ No dialog ] // If[ ]

                // Show Custom Dialog [ Title: "Touch"; Message: "Your Touch has been removed."; Default Button: “OK”, Commit: “Yes” ] // End If

                Go to Layout [ original layout ] End If

                End If

                      

                • 5. Re: Portal with button that checks another table for status
                  AppGuy

                       Phil-

                       Any Ideas???

                        

                  • 6. Re: Portal with button that checks another table for status
                    philmodjunk

                         I don't always spend weekend time in the forum and I limit my comments on any given thread to one per day as otherwise this forum sucks up way too much (unpaid volunteer) time.

                         

                              jsa_form ---<personnel_signin

                         

                              jsa_form---<jsa_portal

                         I can see that much. What I can't tell for sure due to the multiple connection lines are which fields are serving as match fields in these relationships.

                         Looking at your script, it appears to also have one of the problems I pointed out from your previous version: It changes layouts without any code to select a particular record once on that other layout. It will thus reference data from whatever record  happens to be "current" at the time the set field steps execute.

                         What layout is current at the time the script executes? On what table occurrence is it based?

                    • 7. Re: Portal with button that checks another table for status
                      AppGuy

                           Phil-

                           I completely understand and appriciate any help... 

                           FYI- all my pk are UUID's..

                           jsa_form::jsaID -- personnel_signin::jsa_id_sub

                           jsa_form::jsaID -- jsa_portal::jsa_id_sub

                           I think my current Touch_Rate TO relationship is wrong since I am not getting the correct results..

                           The review portal is based on the personnel_sign table with a portal from the jsa_portal. (This may need to be changed??) The portal from jsa_portal is where the button is to log the review for each record. 

                            

                            

                            

                      • 8. Re: Portal with button that checks another table for status
                        philmodjunk

                             The details are clearing: (And I missed a detail in your last script post, that you are assigning data to a NEW record in the touch rate table.)

                             

                                  The review portalLayout is based on the personnel_sign table with a portal from the jsa_portal.

                             The script looks correct for creating a related record in Touch_rate. After running this script a single time, I'd go to a table view of a layout based on Touch Rate and look for a record with these values. You should find that a record has been successfully created.

                             I suspect that you then cannot see the result on your layout due to relationship issues that result in data from a different record from Touch Rate than the one you created being displayed.

                             How are you displaying data on your Pesonnel_Signin based layout? (see more than one possible table occurrence of touch rate)

                        • 9. Re: Portal with button that checks another table for status
                          AppGuy

                               Phil-

                               Yes, that is correct.. The record appears to be there, but there is an relationship issue between the jsa_portal / personnel_signin or Touch_Rate.

                                

                               Since the review button is on each jsa_portal record I appear to get 1 of 2 results.  

                          If [ IsEmpty(Touch_Rate::Touch_Rate_Check_SOP) ]

                               1. All the portal records appear to be already checked at once...  even though only 1 record is created.   This is telling me it is most likely a relationship issue..??

                               2. Or secondly you can mark each one indivually, but the next person that signs in see's the records already reviewed and they can't review them.

                               In both instances it appears to be a relationship issue with my TO's..  Just not sure how to fix it..

                                

                               Here is my script that I use to go to the touch layout..

                                

                          Allow User Abort [ Off ]
                          Set Variable [ $$touchuser; Value:personnel_signin::personnel_id ] If [ IsEmpty ( jsaportal_TOUCHRATE_review::_fkPersonnelSignIn) ]

                          Set Variable [ $portal_id; Value:jsa_portal::id ]
                          Set Variable [ $personnel_id; Value:personnel_signin::personnel_id ]
                          Set Variable [ $jsa_id; Value:personnel_signin::jsa_id_sub ]
                          Go to Layout [ “jsaportal_TouchRate_Review” (jsaportal_TOUCHRATE_review) ]
                          New Record/Request
                                              Set Field
                          [ jsaportal_TOUCHRATE_review::_fkJSAPortal; $portal_id ]
                          Set Field [ jsaportal_TOUCHRATE_review::_fkPersonnelSignIn; $personnel_id ]
                          Set Field [ jsaportal_TOUCHRATE_review::_fkJSA; $jsa_id ]
                          Commit Records/Requests
                                              Go to Related Record
                          [ From table: “personnel_signin”; Using layout: “Touch Rate” (personnel_signin) ]

                          Else
                                              Go to Related Record
                          [ From table: “personnel_signin”; Using layout: “Touch Rate” (personnel_signin) ]

                          End If 

                                               

                               Here is a screenshot of an updated relationship I am tesing with now...  Still not working but trying...

                          • 10. Re: Portal with button that checks another table for status
                            philmodjunk

                                 I don't see any issues with your script. The issues lie with your relationship graph and the design of your layout.

                                 What is the purpose of the three tables involved? What does one record in each table represent?

                                 jsa_portal
                                 Personnel_Signin
                                 Touch_Rate

                            • 11. Re: Portal with button that checks another table for status
                              AppGuy

                                   The jsa_portal is where I am storing all the steps that need to be reviewed.

                                   The Personnel_signin is where I am storing the persons name that signed in.

                                   The touch_Rate is where I am storing the "review" option.

                                   The parent table is jsa_form for the jsa_portal and personnel_signin. They both are both connected via the jsa_id primary key.  I am using UUID's on all tables as a pk.

                                    

                              • 12. Re: Portal with button that checks another table for status
                                philmodjunk

                                     And each user that accesses this layout needs to review the listed records in jsa_portal individually? (If user 1 reviews the item, Users 2, 3, and 4 also need to see an review it before it no longer is listed?)

                                     Or does just one user need to review it?

                                     Should each user see a different list of items to be reviewed?

                                • 13. Re: Portal with button that checks another table for status
                                  AppGuy

                                       Phil-

                                        

                                       The 1st one is correct.. "And each user that accesses this layout needs to review the listed records in jsa_portal individually? (If user 1 reviews the item, Users 2, 3, and 4 also need to see an review it before it no longer is listed?)"

                                       After each user reviews the jsa_portal record I have a "review" button that has a conditional format that will check to see if it is reviewed or not.

                                       Currently there is a field in the touch_rate::touch_Rate_Check_SOP.  When this field has a "1" the button should show reviewed.  When empty it should show "Not Reviewed".

                                       Each user will always see the same list from the jsa_portal table, but they need to be able to review them "individually" (this is where I am having an issue.).

                                        

                                        

                                  • 14. Re: Portal with button that checks another table for status
                                    philmodjunk

                                         This means that you need to match records from the signin layout to touch rate records that match both by Personnel_id and JSA_ID--which does not happen in your current relationships.

                                         From a layout based on Personnel_signin, a portal to jsa_Portal works to display the items up for review, but then you need a link from jsa_Portal to an occurrence of touch_rate that matches by both these values.

                                         There are two methods that come to mind:

                                         Add a global field to jsa_portal for the Personnel_ID and use it as one of the two match fields needed to match to an occurrence of touch_rate. Use a script to load the global field with the current user's ID.

                                         Define an unstored calculation field in jsa_portal that copies the ID from Personnel_Signin. This avoids the script for loading the global, but you may need to script a refresh window to show the values in touch rate change when a person marks off that item as reviewed.

                                    1 2 Previous Next