12 Replies Latest reply on Jun 20, 2013 12:30 AM by SyedAhmed_1

    Display current filed data

    SyedAhmed_1

      Title

      Display current filed data

      Post

      Dear All

       

      Since I am very new to File maker i wanted a help from the expert i know in theory it is simple but unable to solve, the scenario is. I have two tables “HRMaster table” with Current Position and “wages table” with position

      both of them are linked with relationship using primer key and working fine

       

      In the browsmode I have added HRMaster as main and wages as a portal. If I enter a new position in wages “position” it should change current position of HRmaster. If not it should retain its current position of HRMaster

       

      Appreciate your help

       

      Regards

      Zain

        • 1. Re: Display current filed data
          TSGal

               Syed Ahmed:

               Thank you for your post.

               Can you explain what you have now for your calculation formula or script/script trigger?  This will help pinpoint why it isn't working properly.

               TSGal
               FileMaker, Inc.

          • 2. Re: Display current filed data
            SyedAhmed_1

                 Dear TSGal

                 Thanks for the reply, as i said i am new to Filemaker, I have created my first database learning online and i got stuck in this and i need help weather to create a script for this option or is there any simpler way. If it is script with a calculation field can you please provide an example taking my scenario. 

                 Table 1 : HRMaster (Fileds : HR No, name, etc).  Table 2 Wages(Fileds : Salaray Details, Position). I have linked both the table with primery key and it is working.  I wanted to add one field on the main layout and name it as "Current Position". If any changes done on the wages portal "Position" it should display in Current position if not it should be the same. Example If an employee Current Position is Accountant and he/she  gets an increment along with the designation change to Sr. Accountant. the current position should change but i need to maintain the previous position history in wages portal of this employee. I have attached the image for reference  

                  

            Appreciate your help

             

            • 3. Re: Display current filed data
              schamblee

                   I would include a field in the Wages table for position, then the position would stay with that paycheck (This field wouldn't change after check is wrote.)   The Current Position field would be in the HRMaster table, which could change with the employee.   When you create a new payroll check you would include in your script a step to set a Position variable from the Current Position field, then when you go to the Wage layout from your script you would then use set field position from the position variable.

              • 4. Re: Display current filed data
                SyedAhmed_1
                Dear Friend Thanks for your reply as I said earlier that I am new to filemaker I really appreciate if you can show a sample script taking my data. Thanks in advance zain
                • 5. Re: Display current filed data
                  TSGal

                       Syed Ahmed:

                       Thank you for the additional information and screen shot.  This does help.

                       If you want the old position "Accountant" to remain in the Wages table, then you will need to compare that value to the Current Position.  If it is different, then a script can be run that creates a new record with the same key field, and copy the contents of the Currnt Position from the HRMaster file and paste it into the Position of the Wages table.  Something like:

                       If [ HRMaster::CurrentPosition ≠ Wages::Position]

                          Go to Layout [ <layout with Wages table> ]

                          Set Variable [ $key ; <key field> ]

                          Set Variable [ $position ; < Position field > ]

                          New Record/Request

                          Set Field [ <key field> ; $key ]

                          Set Field [ < Position field > ; <HRMaster::CurrentPosition ]

                          Go to Layout [ <layout with HRMaster table> ]

                          Set Field [ < CurrentPosition field > ; $position ]

                       End If

                       -----

                       That is, we check to see if the CurrentPosition matches the Position.  If it does, then nothing happens.  However, if they are not the same, then I switch to the portal layout and grab the current key and Position values.  I then add a new record, replace the key field so it can link back to the HRMaster table, and put the old position into the Position field.  I then switch to the layout with HRMaster information, and replace the CurrentPosition field with the new Position value.

                       Let me know if you need additional clarification.

                       TSGal
                       FileMaker, Inc.

                  • 6. Re: Display current filed data
                    SyedAhmed_1

                         Dear TSGal

                         I am really stuck on this and unable to pass through appriciate your help. I have attached the script whcih i needed to run along with your solution. Please help smiley.

                          

                         thanks

                         Syed

                          

                          

                          

                    • 7. Re: Display current filed data
                      TSGal

                           Syed Ahmed:

                           You have three scripts posted.  Which script is having the issue?  At what point does it fail?

                           TSGal
                           FileMaker, Inc.

                      • 8. Re: Display current filed data
                        SyedAhmed_1

                             Dear TSGal First of all I am sorry to post same script 3 times dont know how this happened. In the above script I am trying to use your solution but without success. I am using the button option on the main layout by clicking that the wages layout should open. If position field changes it should run your script and update the hrmaster current position and once saved it should update the other wages fields such as salary details and display the details on the wages portal in the main layout. The script posted earlier runs the first time it replace the current position with th CPposition but nothing happens if i change the record again. I am sorry Tsgal I am bothering you too much. thanks Syed

                        • 9. Re: Display current filed data
                          TSGal

                               Syed Ahmed:

                               Does this work properly in FileMaker Pro?  Do you have FileMaker Pro or FileMaker Pro Advanced?  If the latter, turn on the Debugger and step through each script step.

                               Since this only occurs the first time, what values appear in the variables the second time?

                               You are definitely not bothering me.  I am here to help FileMaker users.

                               TSGal
                               FileMaker, Inc.

                          • 10. Re: Display current filed data
                            SyedAhmed_1
                            Dear TSGAL I am using filemaker pro 12 advance using the above script it works for for the first record if I want to change again it does not. I feel that something missing in the script or I am not using the if statement provided by you in the right place in the main script Thank syed, I am working on the same project as I type
                            • 11. Re: Display current filed data
                              TSGal

                                   Syed Ahmed:

                                   The only way the IF statement would fail is if HRMaster::CPosition ≠ Wages::Position

                                   Can you verify this is the case?  I don't see where these values are set.

                                   TSGal
                                   FileMaker, Inc.

                              • 12. Re: Display current filed data
                                SyedAhmed_1

                                     Dear TSGal

                                     Thanks a lot for your support, i finally got it right, the issue was with the script

                                     thanks

                                     Syed