7 Replies Latest reply on May 15, 2009 12:25 AM by pvhaute

    What triggers 'Calculated Value'?

    pvhaute

      Title

      What triggers 'Calculated Value'?

      Post

      Hi,

       

      (Pretty basic question i think, but in the knowledge-base i only found something on FM3.)

       

      Situation:

       

      File A:

      Field1: (calculation) gets a value from File B

      Field2: (text, calculated value) writes "Yes" if the value in Field1 is >0

       

       

      Field1 populates correctly, but Field2 does not update (FYI: these are existing records, but have no value yet in Field2)

       

      I use this Field2 to filter records in a portal, therefore i cannot make Field2 a calculation-field (as i cannot index it).

       

      Is there a solution to this situation?

       

      rgds,

       

        • 1. Re: What triggers 'Calculated Value'?
          philmodjunk
            

          Is field two a text field that auto-enters a calculated value?

           

          If so, I believe you'll need to either script something that triggers an update of field 2 everytime field1 updates or replace it with a calculation field. (The calculation will be unstored, which may be why it wasn't set up that way in the first place.)

          • 2. Re: What triggers 'Calculated Value'?
            pvhaute
              

            Thanks PhilModJunk (again),

             

            Yes, Field2 is a text field that auto-enters a calculated value.

             

            I don't think that i can trigger a script on a field-value-change (i'm on FM9).

             

            I originally had Field2 set as a calculation field (preferred, most reliable) but then the result of the filter was wrong (actually it is empty) as i cannot index an unstored calculation. (i used the value "Yes" in a global field of a different file that i linked to TablA-Field2)

             

            Is there another solution (i would imagine that this is a common issue)?

             

            rgds,

             

            • 3. Re: What triggers 'Calculated Value'?
              philmodjunk
                

              In older versions, you can trigger scripts, we just didn't call them script triggers :smileywink:

               

              In the older versions you can "trigger" a script by: clicking a button, opening a file, closing a file.

               

              I don't have any really clever solutions here, (Perhaps someone else does :smileywink: ), but sometimes you can sneak in some updating code into another script that the user has to trigger (with a button click or by closing the file) before they can leave the layout where they may have edited the value. Alternatively, you can do the same update trick when a script is triggered to display or use this value.

               

              This is one of the reasons why I frequently hid the task bar in older solutions and added my own button for navigating through records and layouts in "pre-10" databases. Those buttons often performed a script that included steps that managed issues such as updating a related field or calculation that couldn't be automated through other means.

              • 4. Re: What triggers 'Calculated Value'?
                raybaudi
                  

                StPeter wrote:

                 

                Field1: (calculation) gets a value from File B

                 


                Hi

                 

                can we know that calculation ?


                • 5. Re: What triggers 'Calculated Value'?
                  pvhaute
                    

                  Of course Daniele (happy with any help! :o) )

                   

                  FileA (p_auftrag):

                  Field1 (p_auftrag::Inv_pending): (calculation field) p_auftragart::SUM_Inv_pending

                  Field2 (p_auftrag::Inv_pending_flag): (text, calculated value) if(Inv_pending>0;"Yes";"No")

                   

                  "Inv_pending" retrieves its information correctly from FileB (p_auftragart).

                  "Inv_pending_flag" simply doesn't want to reconsider its value.

                   

                  Does this help?

                  • 6. Re: What triggers 'Calculated Value'?
                    raybaudi
                       p_auftragart::SUM_Inv_pending is a summary field ?
                    • 7. Re: What triggers 'Calculated Value'?
                      pvhaute
                         yes indeed